Background task Runs multiple times per second even after setting up schedule and repeat
See original GitHub issue@philippeowagner @jvamvas
I have added this code to my models. I want the background task to run only once per minute. So i gave the value for schedule
as 60 (seconds) and repeat
= 60 (seconds).
from background_task import background
@background(schedule=60)
def update_queue_status():
print(datetime.now().time())
................
...............
update_queue_status(repeat=60)
But when i run python manage.py process_tasks
, it runs the background task multiple times per second-
(qms_env) (base) C:\Users\shisharma\Documents\futuredev\QMS>python manage.py process_tasks
11:51:06.860161
11:51:06.911026
11:51:06.945932
11:51:07.022755
11:51:07.055640
11:51:07.071596
11:51:07.145399
11:51:07.165345
11:51:07.261117
11:51:07.276049
11:51:07.367802
11:51:07.461586
11:51:07.535353
11:51:07.630100
11:51:07.715872
11:51:07.784686
11:51:07.816629
11:51:07.825579
11:51:07.918329
11:51:07.977172
11:51:08.027037
11:51:08.112807
11:51:08.224510
11:51:08.280358
11:51:08.345213
11:51:08.442924
11:51:08.548641
11:51:08.587536
11:51:08.614464
11:51:08.632415
11:51:08.705221
11:51:08.751128
11:51:08.855819
11:51:08.901694
11:51:08.937628
11:51:08.978518
11:51:09.064289
11:51:09.155046
11:51:09.225828
11:51:08.941590
11:51:09.108143
11:51:08.927654
11:51:09.013395
11:51:09.197934
11:51:59.796843
11:51:59.824775
11:51:59.930155
11:52:00.026355
11:52:00.041316
11:52:00.113123
11:52:00.155011
Is there something wrong with what i am doing.
Thank you Shivani
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Repeating Periodic Tasks | CodePath Android Cliffnotes
This is done by constructing a Handler and then "posting" Runnable code to the event message queue on the thread to be processed....
Read more >The Dangers of Implementing Recurring Background Tasks In ...
If you run your site in a Web Farm, you could end up with multiple instances of your app that all attempt to...
Read more >Windows Task Scheduler: Schedule task to run once every 10 ...
A Windows Task Scheduler trigger cannot repeat more often than every 1 minute, but you can set up multiple triggers. To run a...
Read more >Run a background task on a timer - UWP - Microsoft Learn
If FreshnessTime is set to 15 minutes and OneShot is true, the task will be scheduled to run once starting between 15 and...
Read more >Run scheduled background tasks in ASP.NET Core
In many software projects, there are repetitive tasks; some do just repeat every x seconds after the last instance is finished but you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Managed to solve it by doing
It seems that the problem appears after changing the
repeat
argument. The old tasks keep executing alongside the new ones.This is happening to me too on Django 3.0.2 and backgound_task 1.2.5