diff --git a/osism/commands/service.py b/osism/commands/service.py index fff025df..7a1bb649 100644 --- a/osism/commands/service.py +++ b/osism/commands/service.py @@ -54,7 +54,10 @@ def take_action(self, parsed_args): p.wait() elif service == "flower": - p = subprocess.Popen("celery --broker=redis://redis flower", shell=True) + p = subprocess.Popen( + "celery --broker=redis://redis flower", + shell=True, + ) p.wait() elif service == "reconciler": diff --git a/osism/commands/wait.py b/osism/commands/wait.py index 108b42ce..2c43a2fb 100644 --- a/osism/commands/wait.py +++ b/osism/commands/wait.py @@ -97,6 +97,7 @@ def take_action(self, parsed_args): host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=settings.REDIS_DB, + socket_keepalive=True, ) redis.ping() diff --git a/osism/tasks/__init__.py b/osism/tasks/__init__.py index 904e2ad4..7d902852 100644 --- a/osism/tasks/__init__.py +++ b/osism/tasks/__init__.py @@ -42,7 +42,10 @@ def celery_init_worker(**kwargs): global redis redis = Redis( - host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=settings.REDIS_DB + host=settings.REDIS_HOST, + port=settings.REDIS_PORT, + db=settings.REDIS_DB, + socket_keepalive=True, ) redis.ping() @@ -230,7 +233,10 @@ def handle_task(t, wait, format, timeout): if not redis: redis = Redis( - host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=settings.REDIS_DB + host=settings.REDIS_HOST, + port=settings.REDIS_PORT, + db=settings.REDIS_DB, + socket_keepalive=True, ) redis.ping() diff --git a/osism/tasks/conductor.py b/osism/tasks/conductor.py index 1f8efb2c..9907fd94 100644 --- a/osism/tasks/conductor.py +++ b/osism/tasks/conductor.py @@ -24,7 +24,10 @@ def celery_init_worker(**kwargs): global redis redis = Redis( - host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=settings.REDIS_DB + host=settings.REDIS_HOST, + port=settings.REDIS_PORT, + db=settings.REDIS_DB, + socket_keepalive=True, ) redis.ping() diff --git a/osism/tasks/netbox.py b/osism/tasks/netbox.py index 4cbdfbbc..85e8b5d9 100644 --- a/osism/tasks/netbox.py +++ b/osism/tasks/netbox.py @@ -33,7 +33,10 @@ def celery_init_worker(**kwargs): global redis redis = Redis( - host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=settings.REDIS_DB + host=settings.REDIS_HOST, + port=settings.REDIS_PORT, + db=settings.REDIS_DB, + socket_keepalive=True, ) redis.ping() diff --git a/osism/tasks/openstack.py b/osism/tasks/openstack.py index e6c8aec9..b4b94499 100644 --- a/osism/tasks/openstack.py +++ b/osism/tasks/openstack.py @@ -42,7 +42,10 @@ def celery_init_worker(**kwargs): global redis redis = Redis( - host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=settings.REDIS_DB + host=settings.REDIS_HOST, + port=settings.REDIS_PORT, + db=settings.REDIS_DB, + socket_keepalive=True, ) redis.ping() diff --git a/osism/tasks/reconciler.py b/osism/tasks/reconciler.py index 80671a87..6d2b47bc 100644 --- a/osism/tasks/reconciler.py +++ b/osism/tasks/reconciler.py @@ -38,7 +38,10 @@ def celery_init_worker(**kwargs): global redis redis = Redis( - host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=settings.REDIS_DB + host=settings.REDIS_HOST, + port=settings.REDIS_PORT, + db=settings.REDIS_DB, + socket_keepalive=True, ) redis.ping() diff --git a/osism/utils/__init__.py b/osism/utils/__init__.py index 18e72719..520317ae 100644 --- a/osism/utils/__init__.py +++ b/osism/utils/__init__.py @@ -5,7 +5,12 @@ from redis import Redis import urllib3 -redis = Redis(host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=settings.REDIS_DB) +redis = Redis( + host=settings.REDIS_HOST, + port=settings.REDIS_PORT, + db=settings.REDIS_DB, + socket_keepalive=True, +) redis.ping() if settings.NETBOX_URL and settings.NETBOX_TOKEN: