Compare commits
No commits in common. "e69ee8767ad2e9b3ac56b49b6a97f6df7cd179d7" and "54f7581657cf74583e3a6bc4733a1486692f5963" have entirely different histories.
e69ee8767a
...
54f7581657
@ -23,22 +23,16 @@ class Daemon(base.Daemon):
|
||||
process = self.telegram_pollers[project_name][bot_name]
|
||||
if bot_info.get('poll_enabled'):
|
||||
if process is not None and process.is_alive:
|
||||
print(f'process for {project_name} {bot_name} is alive')
|
||||
continue
|
||||
new_process = multiprocessing.Process(target=self.start_polling, args=[bot_info['secrets']['telegram_token'], bot_info['queue']])
|
||||
print(f'starting process for {project_name} {bot_name} is alive')
|
||||
new_process.start()
|
||||
self.telegram_pollers[project_name][bot_name] = new_process
|
||||
print(f'started process for {project_name} {bot_name} is alive')
|
||||
else:
|
||||
if process is None or not process.is_alive:
|
||||
print(f'process for {project_name} {bot_name} is not alive')
|
||||
if process is None:
|
||||
continue
|
||||
if process.is_alive:
|
||||
print(f'terminating process for {project_name} {bot_name}')
|
||||
process.terminate()
|
||||
self.telegram_pollers[project_name][bot_name] = None
|
||||
print(f'terminated process for {project_name} {bot_name}')
|
||||
time.sleep(10)
|
||||
|
||||
def start_polling(self, telegram_token, queue):
|
||||
|
Loading…
Reference in New Issue
Block a user