Skip to content

Commit

Permalink
missed this file
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed Jan 16, 2025
1 parent 6a6a42d commit c4edcdd
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions awx/main/utils/redis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import sys
import time

from django.conf import settings

import redis


def ping_redis():
redis.Redis.from_url(settings.BROKER_URL).ping()


def exit_if_redis_down(logger):
try:
ping_redis()
except redis.ConnectionError as exc:
logger.info(f'Redis ping error: {exc}')
time.sleep(1) # Patience to avoid log spam
sys.exit(1)

Check warning on line 19 in awx/main/utils/redis.py

View check run for this annotation

Codecov / codecov/patch

awx/main/utils/redis.py#L14-L19

Added lines #L14 - L19 were not covered by tests

0 comments on commit c4edcdd

Please sign in to comment.