Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
raise RedisLiteException('The binary redis-server failed to start')
# Wait for Redis to start
timeout = True
for i in range(0, self.start_timeout * 10):
if os.path.exists(self.socket_file):
timeout = False
break
time.sleep(.1)
if timeout: # pragma: no cover
raise RedisLiteServerStartError(
'The redis-server process failed to start'
)
if not os.path.exists(self.socket_file): # pragma: no cover
raise RedisLiteException(
'Redis socket file %s is not present' % self.socket_file
)
self._save_setting_registry()
self.running = True
with open(self.redis_configuration_filename, 'w') as file_handle:
file_handle.write(self.redis_configuration)
redis_executable = __redis_executable__
if not redis_executable: # pragma: no cover
redis_executable = 'redis-server'
command = [redis_executable, self.redis_configuration_filename]
logger.debug('Running: %s', ' '.join(command))
rc = subprocess.call(command)
if rc: # pragma: no cover
logger.debug('The binary redis-server failed to start')
redis_log = os.path.join(self.redis_dir, 'redis.log')
if os.path.exists(redis_log):
with open(redis_log) as file_handle:
logger.debug(file_handle.read())
raise RedisLiteException('The binary redis-server failed to start')
# Wait for Redis to start
timeout = True
for i in range(0, self.start_timeout * 10):
if os.path.exists(self.socket_file):
timeout = False
break
time.sleep(.1)
if timeout: # pragma: no cover
raise RedisLiteServerStartError(
'The redis-server process failed to start'
)
if not os.path.exists(self.socket_file): # pragma: no cover
raise RedisLiteException(
'Redis socket file %s is not present' % self.socket_file