Replies: 1 comment
-
I just realized there is also a question of persistence - is the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, general question:
I have a Label scheduler with two tasks based on the CRON schedule - all work as expected.
Now, I need to delay some tasks by, say, 1-2 seconds. From other discussions, I got the idea that using
asyncio.sleep()
is one option, albeit not recommended, and that the preferred solution would be to use Dynamic scheduling andtask.schedule_by_time
.Tasks meant for dynamic scheduling are different from tasks I need to schedule by CRON.
Can I just do something like:
Will this work? By that, I mean the
cron_task
will be fired every day at 3 AM and that thedelayed_task
will be fired 10 seconds after every invocation ofawait delayed_task.schedule_by_time()
function? If so, I don't get the use case for merging functions described https://taskiq-python.github.io/guide/scheduling-tasks.html#multiple-sources. Do I need to use that?Or eventually, should I just use
asyncio.sleep
for the simple use case of delaying background task run by a few seconds?Cheers
Beta Was this translation helpful? Give feedback.
All reactions