mirror of https://github.com/jumpserver/jumpserver
perf: 优化启动速度
parent
11a58dc7ad
commit
9d80abadd8
|
@ -44,9 +44,12 @@ class BaseService(object):
|
|||
if self.is_running:
|
||||
msg = f'{self.name} is running: {self.pid}.'
|
||||
else:
|
||||
msg = '\033[31m{} is stopped.\033[0m\nYou can manual start it to find the error: \n' \
|
||||
' $ cd {}\n' \
|
||||
' $ {}'.format(self.name, self.cwd, ' '.join(self.cmd))
|
||||
msg = f'{self.name} is stopped.'
|
||||
if DEBUG:
|
||||
msg = '\033[31m{} is stopped.\033[0m\nYou can manual start it to find the error: \n' \
|
||||
' $ cd {}\n' \
|
||||
' $ {}'.format(self.name, self.cwd, ' '.join(self.cmd))
|
||||
|
||||
print(msg)
|
||||
|
||||
# -- log --
|
||||
|
@ -147,7 +150,6 @@ class BaseService(object):
|
|||
self.remove_pid()
|
||||
break
|
||||
else:
|
||||
time.sleep(1)
|
||||
continue
|
||||
|
||||
def watch(self):
|
||||
|
@ -203,4 +205,3 @@ class BaseService(object):
|
|||
logging.info(f'Remove old log: {to_delete_dir}')
|
||||
shutil.rmtree(to_delete_dir, ignore_errors=True)
|
||||
# -- end action --
|
||||
|
||||
|
|
|
@ -40,7 +40,8 @@ class ServicesUtil(object):
|
|||
service: BaseService
|
||||
service.start()
|
||||
self.files_preserve_map[service.name] = service.log_file
|
||||
time.sleep(1)
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
def stop(self):
|
||||
for service in self._services:
|
||||
|
|
Loading…
Reference in New Issue