Skip to content

Commit

Permalink
Log exceptions with logger.exception (Koed00#42)
Browse files Browse the repository at this point in the history
Co-authored-by: Andreas Bok Andersen <[email protected]>
  • Loading branch information
bokchan and Andreas Bok Andersen authored Nov 30, 2022
1 parent 3c0c327 commit 2566955
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django_q/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def pusher(task_queue: Queue, event: Event, broker: Broker = None):
try:
task_set = broker.dequeue()
except Exception as e:
logger.error(e, traceback.format_exc())
logger.exception("Failed to pull task from broker")
# broker probably crashed. Let the sentinel handle it.
sleep(10)
break
Expand All @@ -378,7 +378,7 @@ def pusher(task_queue: Queue, event: Event, broker: Broker = None):
try:
task = SignedPackage.loads(task[1])
except (TypeError, BadSignature) as e:
logger.error(e, traceback.format_exc())
logger.exception("Failed to push task to queue")
broker.fail(ack_id)
continue
task["ack_id"] = ack_id
Expand Down

0 comments on commit 2566955

Please sign in to comment.