-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: add notes that timer jobs should be side-effect-free #682
Conversation
This fixes a disappearing timer situation described by Timo in https://dfinity.slack.com/archives/CPL67E7MX/p1736347600078339. It turns out that under high message load the `async` timer servicing routine cannot be run. The fix is simple, check if the self-call succeeded (causes a `throw` already), and if not, set a very near global timer to retry ASAP (in the top-level `catch`). TODO: - [x] `catch` send errors for user workers (and mitigate) — see #4852 - [ ] document that the user thunk may be called more than once, and thus should have no side effects other than submitting the self-call — see dfinity/motoko-base#682
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this actually make sense though? The only reason to execute a timer is for a side effect. I'm not sure we need to specify this since we only try to enqueue the job and repeat on failure to enqueue, in which case the failed job has no effect.
E.g. somebody could pre-compose the thunk with |
I don't think there's any way to precomposed without wrapping in another async function but that legacy flag could indeed be problematic. I'll approve anyway though |
1 similar comment
I don't think there's any way to precomposed without wrapping in another async function but that legacy flag could indeed be problematic. I'll approve anyway though |
... other than submitting the self-call, of course