Skip to content

Commit

Permalink
Merge pull request #94 from bionikspoon/patch-1
Browse files Browse the repository at this point in the history
Fixes #93  Make sure `psutil` is available
  • Loading branch information
dwighthubbard committed Mar 4, 2016
2 parents f71e4e7 + 6c5620b commit 1fabe67
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions redislite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import subprocess
import tempfile
import time
import sys
from . import configuration
from . import __redis_executable__

Expand Down Expand Up @@ -61,11 +62,14 @@ class RedisMixin(object):
redis_configuration = None
redis_configuration_filename = None

def _cleanup(self):
def _cleanup(self, sys_modules=None):
"""
Stop the redis-server for this instance if it's running
:return:
"""
if sys_modules:
import sys
sys.modules.update(sys_modules)

if self.pid:
logger.debug('Connection count: %s', self._connection_count())
Expand Down Expand Up @@ -312,7 +316,7 @@ def __init__(self, *args, **kwargs):

logger.debug('Setting up redis with rdb file: %s', self.dbfilename)
logger.debug('Setting up redis with socket file: %s', self.socket_file)
atexit.register(self._cleanup)
atexit.register(self._cleanup, sys.modules.copy())
if self._is_redis_running() and not self.socket_file:
self._load_setting_registry()
logger.debug(
Expand Down

0 comments on commit 1fabe67

Please sign in to comment.