Dear experts,
I have a webserver that is basically copied from joeblog’s https://github.com/roblaing/swipl-webapp-howto. On startup, a few computationally expensive things are prepared and stored in temporary files (tmp_file_stream & Co). I noticed that these temporary files are immediately deleted after the webserver changes to daemon mode, you know, :- use_module(library(http/http_unix_daemon)). And then everything is lost.
I thought I would be smarter than swipl by deleting and recreating the tempfiles and deleting them myself in a hook from at_exit, but this hook also seems to be invoked when the server switches to deamon mode. Is this behavior intended? Or might it make sense to have something like the broadcast events http(pre_server_start) and http(post_server_start) - not for the start but for the end of the server (i.e., when I kill it)?
My current workaround is to save the files in the local folder.
Best wishes,
Matthias