lilspikey / django-background-task

A database-backed work queue for Django
BSD 3-Clause "New" or "Revised" License
107 stars 207 forks source link

Background task Runs multiple times per second even after setting up schedule and repeat #32

Open shivanish opened 5 years ago

shivanish commented 5 years ago

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

https://github.com/arteria/django-background-tasks/issues/200

shivanish commented 5 years ago

@lilspikey