From cef1088984461004e533780183f7c5fe25aaba9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Fri, 26 Nov 2021 12:35:15 -0500 Subject: [PATCH] chg: programmatically shutdown DBs --- bin/run_backend.py | 10 ++++++++-- cache/shutdown_redis.sh | 6 ------ indexing/shutdown_redis.sh | 6 ------ 3 files changed, 8 insertions(+), 14 deletions(-) delete mode 100755 cache/shutdown_redis.sh delete mode 100755 indexing/shutdown_redis.sh diff --git a/bin/run_backend.py b/bin/run_backend.py index a48a5fb..fe22d3a 100755 --- a/bin/run_backend.py +++ b/bin/run_backend.py @@ -35,7 +35,10 @@ def launch_cache(storage_directory: Optional[Path]=None): def shutdown_cache(storage_directory: Optional[Path]=None): if not storage_directory: storage_directory = get_homedir() - Popen(["./shutdown_redis.sh"], cwd=(storage_directory / 'cache')) + r = Redis(unix_socket_path=get_socket_path('cache')) + r.save() + r.shutdown() + print('Redis cache database shutdown.') def launch_indexing(storage_directory: Optional[Path]=None): @@ -48,7 +51,10 @@ def launch_indexing(storage_directory: Optional[Path]=None): def shutdown_indexing(storage_directory: Optional[Path]=None): if not storage_directory: storage_directory = get_homedir() - Popen(["./shutdown_redis.sh"], cwd=(storage_directory / 'indexing')) + r = Redis(unix_socket_path=get_socket_path('indexing')) + r.save() + r.shutdown() + print('Redis indexing database shutdown.') def launch_all(): diff --git a/cache/shutdown_redis.sh b/cache/shutdown_redis.sh deleted file mode 100755 index 0afce32..0000000 --- a/cache/shutdown_redis.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -# set -e -set -x - -../../redis/src/redis-cli -s ./cache.sock shutdown diff --git a/indexing/shutdown_redis.sh b/indexing/shutdown_redis.sh deleted file mode 100755 index 362243e..0000000 --- a/indexing/shutdown_redis.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -# set -e -set -x - -../../redis/src/redis-cli -s ./indexing.sock shutdown