mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 14:56:01 +00:00
Changes from self review
This commit is contained in:
@@ -2,7 +2,7 @@ from redis import Redis, ConnectionError
|
||||
|
||||
from config import REDIS_HOST, REDIS_PORT
|
||||
|
||||
redis_client = Redis(host=REDIS_HOST, port=REDIS_PORT, db=0) # decode_responses
|
||||
redis_client = Redis(host=REDIS_HOST, port=REDIS_PORT, db=0)
|
||||
redis_url = f"redis://{REDIS_HOST}:{REDIS_PORT}"
|
||||
|
||||
try:
|
||||
@@ -37,5 +37,6 @@ class FallbackCache:
|
||||
return repr(self)
|
||||
|
||||
|
||||
# A seperate client that auto-decodes responses is needed
|
||||
_cache_client = Redis(host=REDIS_HOST, port=REDIS_PORT, db=0, decode_responses=True)
|
||||
cache = _cache_client if redis_connectable else FallbackCache()
|
||||
|
||||
@@ -6,8 +6,9 @@ from utils.cache import redis_client, redis_connectable
|
||||
listen = ["high", "default", "low"]
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Exit if Redis is not connectable
|
||||
if not redis_connectable:
|
||||
sys.exit(2)
|
||||
sys.exit(0)
|
||||
|
||||
with Connection(redis_client):
|
||||
worker = Worker(map(Queue, listen))
|
||||
|
||||
Reference in New Issue
Block a user