I’ve got a Django app running on fly.io that allows users to check out a product for X amount of time, then return it when they’re finished. The problem is that some users either forget to return the product when the time has elapsed, or intentionally keep it out longer. I’d like to remind users to return the product as follows.
-
When X is checked out, add a new db record with an expected “return by” time.
- The time varies based on product: some might be 30 minutes, some might be 90, etc.
-
If the user returns the product before the return by time, the record is marked as done.
-
If the user has not returned the product within the allotted time, I email them to ask them to return the product.
I was originally thinking of using a queueing system like Celery, but there’s probably not going to be more than 20-30 users in this situation. So I was looking at a cron system and found Supercronic.
This sounds like exactly what I need, but I have a few questions. Can Supercronic call Django manage commands? if so then I could just set a cron to run every X minutes (5 minutes perhaps—precision isn’t terribly important here). It would call a Django command that checks the state of anything marked as “checked out”, with a timestamp older than the desired duration. It would then perform the task on any matching records?