Skip to content

Commit a2877d3

Browse files
committed
Merge branch 'resillient-cron-scheduler'
2 parents 5c359bf + 9af4683 commit a2877d3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

django_lightweight_queue/cron_scheduler.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,15 @@ def run(self) -> None:
5050
)
5151

5252
while True:
53-
# This will run until the process terminates.
54-
self.tick(backend)
53+
try:
54+
# This will run until the process terminates.
55+
self.tick(backend)
56+
except Exception:
57+
# Log that something went wrong, but ensure that this thread
58+
# carries on running. Otherwise a single network error talking
59+
# to a backend can result in the cron scheduler dying until a
60+
# human notices that things aren't running.
61+
self.logger.exception("Error during tick")
5562

5663
# Sleep until the next second boundary. This corrects for skew
5764
# caused by the accumulation of tick() runtime.

0 commit comments

Comments
 (0)