Hello š
I need to run a function just once a month periodically on the server (or twice a month whatever). How can I achieve this with ktor, can you just use coroutines for such big delays?
j
jw
11/07/2021, 2:52 PM
Yes, but you should really use a database table to record pending future work instead. Then, if you server is down when it was supposed to run the work it will start up, see the work, use a transaction to atomically mark the work as started, and when completed atomically mark the work as done and insert a new row for the next run.
āļø 3
While the server is up you can poll the table to see if it's time to run work at regular intervals, such as once per minute
c
coroutinedispatcher
11/07/2021, 2:54 PM
Great. Yea, would need to use a database as well š Thank you.