From d48d3b672f56a7d457cb88adcf2f1997e854add9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 20:26:45 +0000 Subject: [PATCH 1/4] Initial plan From 3bd6271c1572b2043973c7e422f81f8d15b0b6f3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Feb 2026 20:30:56 +0000 Subject: [PATCH 2/4] Fix warnings: use execute_command for shutdown and shutil.which instead of find_executable Co-authored-by: gkorland <753206+gkorland@users.noreply.github.com> --- redislite/client.py | 3 ++- redislite/debug.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/redislite/client.py b/redislite/client.py index 5b299982..b55b8975 100644 --- a/redislite/client.py +++ b/redislite/client.py @@ -109,7 +109,8 @@ def _cleanup(self, sys_modules=None): if getattr(self, '_async_managed', False): logger.debug('Skipping shutdown for async-managed client') return # Let async wrapper handle shutdown - self.shutdown(save=True, now=True, force=True) + # Use execute_command to avoid async/sync confusion + self.execute_command('SHUTDOWN', 'SAVE', 'NOW', 'FORCE') try: # pragma: no cover process = psutil.Process(pid) except psutil.NoSuchProcess: # pragma: no cover diff --git a/redislite/debug.py b/redislite/debug.py index 6941dbee..710e07ab 100644 --- a/redislite/debug.py +++ b/redislite/debug.py @@ -45,8 +45,8 @@ the module and it's build information. """ from __future__ import print_function -from distutils.spawn import find_executable import os +import shutil from .__init__ import __version__, __git_version__, __source_url__, \ __git_hash__, __git_origin__, __git_branch__, __redis_server_info__, \ __redis_executable__ @@ -58,7 +58,7 @@ def debug_info_list(): :return: """ info = [] - redis_server = find_executable('redis-server') + redis_server = shutil.which('redis-server') if __redis_executable__: # pragma: no cover redis_server = __redis_executable__ info.append("Redislite debug information:") From ced665b02da38f5070447ea33c95131d3fd83aed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 08:48:00 +0000 Subject: [PATCH 3/4] Use runtime check for async/sync shutdown as suggested by @gkorland Co-authored-by: gkorland <753206+gkorland@users.noreply.github.com> --- redislite/client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/redislite/client.py b/redislite/client.py index b55b8975..bcb6898f 100644 --- a/redislite/client.py +++ b/redislite/client.py @@ -11,6 +11,7 @@ :class:`redis.StrictRedis()` classes. """ import atexit +import inspect import json import logging import os @@ -109,8 +110,13 @@ def _cleanup(self, sys_modules=None): if getattr(self, '_async_managed', False): logger.debug('Skipping shutdown for async-managed client') return # Let async wrapper handle shutdown - # Use execute_command to avoid async/sync confusion - self.execute_command('SHUTDOWN', 'SAVE', 'NOW', 'FORCE') + # Check if shutdown is a coroutine function to avoid async/sync confusion + if hasattr(self, 'shutdown') and inspect.iscoroutinefunction(self.shutdown): + # If it's async, use execute_command which is always synchronous + self.execute_command('SHUTDOWN', 'SAVE', 'NOW', 'FORCE') + else: + # Use the normal shutdown method + self.shutdown(save=True, now=True, force=True) try: # pragma: no cover process = psutil.Process(pid) except psutil.NoSuchProcess: # pragma: no cover From 09bd73c4d14a14d975d8cda821ba08d2102fdd6a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Feb 2026 10:51:36 +0000 Subject: [PATCH 4/4] Use asyncio.run() for async shutdown as suggested by @gkorland Co-authored-by: gkorland <753206+gkorland@users.noreply.github.com> --- redislite/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/redislite/client.py b/redislite/client.py index bcb6898f..b28ee4aa 100644 --- a/redislite/client.py +++ b/redislite/client.py @@ -10,6 +10,7 @@ they are functionally identical to the :class:`redis.Redis()` and :class:`redis.StrictRedis()` classes. """ +import asyncio import atexit import inspect import json @@ -112,8 +113,8 @@ def _cleanup(self, sys_modules=None): return # Let async wrapper handle shutdown # Check if shutdown is a coroutine function to avoid async/sync confusion if hasattr(self, 'shutdown') and inspect.iscoroutinefunction(self.shutdown): - # If it's async, use execute_command which is always synchronous - self.execute_command('SHUTDOWN', 'SAVE', 'NOW', 'FORCE') + # If it's async, use asyncio.run to properly await it + asyncio.run(self.shutdown(save=True, now=True, force=True)) else: # Use the normal shutdown method self.shutdown(save=True, now=True, force=True)