D
D
DEUS92019-10-15 09:52:11
Python
DEUS9, 2019-10-15 09:52:11

How to call a function according to the time specified in the database?

What is the best way to process the task when each user in the database has time to receive some data, each time is different. You need to call the function at the specified time in the database. For now, the solution is to use a separate function that will once in a while look at the time values ​​​​and form a scheduler. Are there any other solutions?5da56c6fb7110820317193.jpeg

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey c0re, 2019-10-15
@erge

user - program user?
if the user of the program then, because everyone has a different time ... then, IMHO, one task is written - a procedure that will run with a minimum tick (time quantum, for example, every minute or every 5 minutes), read the task (s) from the table for the current "tick" of time and perform them, mark the task as completed, in case of successful completion.
You can of course get confused and create a Job for each user task.

F
Forevka69, 2019-10-15
@Forevka69

As an option, create a table in which there will be a task ID and time for the task and pull out the last 100 tasks, sorting them by time, store these tasks in some cache and then work with them.
I would advise you to write some kind of service for this

I
iddqda, 2019-10-15
@iddqda

maybe this will help Flask Mega-Tutorial, Part XXII: Background Tasks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question