Sensible log behavior when redis is unavailable (#15466)

* Sensible log behavior when redis is unavailable

* Consistent behavior with dispatcher and callback
This commit is contained in:
Alan Rominger
2025-04-10 16:45:05 -04:00
committed by GitHub
parent 7a3010f0e6
commit c3ee0c2d8a
6 changed files with 48 additions and 13 deletions

View File

@@ -10,6 +10,8 @@ import time
import sys
import signal
import redis
# Django
from django.db import transaction
from django.utils.translation import gettext_lazy as _, gettext_noop
@@ -120,6 +122,8 @@ class TaskBase:
self.subsystem_metrics.pipe_execute()
else:
logger.debug(f"skipping recording {self.prefix} metrics, last recorded {time_last_recorded} seconds ago")
except redis.exceptions.ConnectionError as exc:
logger.warning(f"Redis connection error saving metrics for {self.prefix}, error: {exc}")
except Exception:
logger.exception(f"Error saving metrics for {self.prefix}")