From 449c2a6691888d9b598e3d920a5e2ad8d99456e6 Mon Sep 17 00:00:00 2001 From: Trenton Holmes Date: Tue, 12 Jul 2022 13:25:06 -0700 Subject: [PATCH] Only loop if the scheduler is enabled --- django_q/cluster.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/django_q/cluster.py b/django_q/cluster.py index b10e1462..6ad02662 100644 --- a/django_q/cluster.py +++ b/django_q/cluster.py @@ -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: