[Answer]-How to queue up scheduled actions

1👍

It depends on how much accuracy you need. Do you want users to select the time down to the minute? second? or will allowing them to select the hour they wish to be emailed be enough.

If on the hour is accurate enough, then use a task that polls for users to mail every hour.

If your users need the mail to go out accurate to the second, then set a task for each user timed to complete on that second.

Everything in between comes down to personal choice. What are you more comfortable doing, and even more importantly: what produces the simplest code with the fewest failure modes?

👤Thomas

0👍

I would suggest the first option (scheduled job that looks up outstanding jobs) – easier to scale and manage. What if you have 1000s of users – that is a lot of tasks JUST for sending emails.

If you use your database as celery broker, you can use django-celery’s built in cron-like scheduling, which would allow you to create and destroy tasks dynamically. I don’t like using the DB for my broker, though.

Also, you might want to check out chronos

👤Goro

Leave a comment