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
When I use something like scheduler.every(1.hours()).run(move || {}), it only does the first time job after one hour after application starting, can we make it or provide an option to trigger it at once for the first round? Thank you!
The text was updated successfully, but these errors were encountered:
kvzn
changed the title
Can me make it execute the first time instantly after starting?
Can we make it execute the first time instantly after starting?
Dec 16, 2022
Right now with a frequency of 1/hour, it will wait until the next even hour (e.g. 1:00, 2:00, etc.) to run. The main reasoning behind this is so that you can stop and restart the program while maintaining consistent intervals between runs (unless the program was stopped when things would have run.)
Given that, would your expectation be that the task runs immediately, and then again 60 minutes later, or that it runs immediately, and the next run would be according to the hourly schedule described above?
Not the original author, but I'd be interested in the ability to opt in to the latter for a particular async schedule personally.
it runs immediately, and the next run would be according to the hourly schedule described above
Essentially the way i work around it currently is on app startup i use tokio::spawn to run the action once, then put it into the AsyncScheduler in the same area of code.
The particular things i'm doing this for is
a) fetch configuration from a key value store, then setup a schedule to fetch it every so often
b) fetch expensive db data at application start, then setup a schedule to refresh it hourly.
When I use something like
scheduler.every(1.hours()).run(move || {})
, it only does the first time job after one hour after application starting, can we make it or provide an option to trigger it at once for the first round? Thank you!The text was updated successfully, but these errors were encountered: