Repository navigation
Daemon cleanup callback #593
Replies: 6 comments 5 replies
|
You'd need to call Another possibility to consider if cleanup is heavy is to just have single task daemons, e.g. Other than that I don't think you can get around co-locating the cleanup code. |
|
|
|
That question has been asked before, so see: https://mirai.r-lib.org/articles/v07-questions.html#launching-daemons---vanilla |
|
Is it possible to configure this per |
|
And actually, now I realize |
|
A daemon is never idle in the same way as we might be idle at a REPL, it's always waiting for the next task. |
Uh oh!
There was an error while loading. Please reload this page.
I am looking for a way to run some "cleanup logic" after a
miraihas completed. Obviously this cleanup logic has to run on the same daemon that executed themirai. Is there such a functionality? Is there the ability to run amiraion a specific daemon? How can one identify daemons?With
everywhereit is possible to run the cleanup logic on all daemons, but even with.min == 1, all existing daemons are waited on which introduces unwanted delays.I can also obviously collocate the cleanup logic with the rest of the logic in a single
mirai, but the reason I am trying to split this up is because that cleanup logic takes some time and I want to be able to do something early with the result while the cleanup runs in the background.I have also tried collocating but setting up the cleanup logic via
later::laterso as to not block on it, but then it seems I still need a way to triggerlater::run_now()on that specific daemon and then this is the same problem as above where you replace "cleanup logic" with "later::run_now()callback", sincelater::run_now()is blocking...A different way to solve the problem would be to figure out why
later::later()callbacks do not run automatically in the background once the daemon has returned. But I don't know how this can be done.All reactions