mirror of
https://github.com/healthchecks/healthchecks.git
synced 2025-04-07 14:15:34 +00:00
Fix exception logging in sendalerts
The on_notify_done callback was accessing exception data incorrectly. If there's been an exception in the thread, it will be re-thrown while calling future.result(), and we must catch it with "try ... except" instead of calling future.exception().
This commit is contained in:
parent
18585d163d
commit
74b7860a0d
1 changed files with 4 additions and 3 deletions
|
@ -79,10 +79,11 @@ class Command(BaseCommand):
|
||||||
def on_notify_done(self, future: Future[str | None]) -> None:
|
def on_notify_done(self, future: Future[str | None]) -> None:
|
||||||
close_old_connections()
|
close_old_connections()
|
||||||
self.seats.release()
|
self.seats.release()
|
||||||
if logs := future.result():
|
|
||||||
self.stdout.write(logs)
|
|
||||||
|
|
||||||
if exc := future.exception():
|
try:
|
||||||
|
if logs := future.result():
|
||||||
|
self.stdout.write(logs)
|
||||||
|
except Exception as exc:
|
||||||
logger.error("Exception in notify", exc_info=exc)
|
logger.error("Exception in notify", exc_info=exc)
|
||||||
raise exc
|
raise exc
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue