Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Only loop if the scheduler is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
stumpylog committed Sep 3, 2022
1 parent ba18c7b commit 449c2a6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions django_q/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ def __init__(self, broker: Broker, event: threading.Event):
self.stopped = event

def run(self):
# Call once on thread start
scheduler(self.broker)
while not self.stopped.wait(60.0):
# Call thereafter every ~60s
# Only do a loop if configured to enable schedules
if Conf.SCHEDULER:
# Call once at startup
scheduler(self.broker)
while not self.stopped.wait(60.0):
# Call thereafter every ~60s
scheduler(self.broker)


class Cluster:
Expand Down

0 comments on commit 449c2a6

Please sign in to comment.