M
M
mr_drinkens892017-01-18 16:34:45
Django
mr_drinkens89, 2017-01-18 16:34:45

How to implement a notification system?

Hello.
The Task model has a notification_time field. The user puts the date when to "notify" him.
How to trigger an event when the current time is equal to notification_time?
In fact, it is somewhat reminiscent of an alarm clock)
So far I see this option:
Run celery + redis, and poll all Tasks once a minute, and take those with notification_time = current time.
I think there are more rational solutions, so as not to interrogate all tasks.
Thank you in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Smirnov, 2017-01-18
@ap0stal

And why can't you immediately retrieve Task from the database where notification_time <= current time and which have not been notified yet?
That is, you need one more field - notification status (0 - not notified, 1 - notified).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question