Hello :slightly_smiling_face: I need to run a func...
# ktor
c
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
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
Great. Yea, would need to use a database as well 🙂 Thank you.