You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a web app which takes over a minute to initialise, reporting
various interesting stats and warnings; if successful, I call
http_daemon, using the output(File) option, but this is too late to
redirect msgs from init.
What is best practice here? If I start the daemon first, might requests
be (mis)handled before the app is ready?
Normally I'd not use --output=file, but use the logging facility of the
daemon manager (e.g., systemd). One way to deal with slow-starting
apps is to setup a temporary handler while you initialize the application.
That is what ClioPatria is doing while restoring the RDF database:
Here, rdf_attach_store/2 is the slow call. The handler does:
busy_loading(_Request) :-
rdf_statistics(triples(Triples)),
( loading_done(Nth, Total)
-> Extra = [ '; ~D of ~D graphs.'-[Nth, Total] ]
; Extra = [ '.' ]
),
HTML = p([ 'This service is currently restoring its ',
'persistent database.', br([]),
'Loaded ~D triples'-[Triples]
| Extra
]),
throw(http_reply(unavailable(HTML))).
Cheers --- Jan
The text was updated successfully, but these errors were encountered:
Normally I'd not use --output=file, but use the logging facility of the
daemon manager (e.g., systemd). One way to deal with slow-starting
apps is to setup a temporary handler while you initialize the application.
That is what ClioPatria is doing while restoring the RDF database:
Here, rdf_attach_store/2 is the slow call. The handler does:
busy_loading(_Request) :-
rdf_statistics(triples(Triples)),
( loading_done(Nth, Total)
-> Extra = [ '; ~D of ~D graphs.'-[Nth, Total] ]
; Extra = [ '.' ]
),
HTML = p([ 'This service is currently restoring its ',
'persistent database.', br([]),
'Loaded ~D triples'-[Triples]
| Extra
]),
throw(http_reply(unavailable(HTML))).
The text was updated successfully, but these errors were encountered: