Compare commits

..

No commits in common. "32197fd6995681d7dc69858168174464abf10e2a" and "e69ee8767ad2e9b3ac56b49b6a97f6df7cd179d7" have entirely different histories.

4 changed files with 13 additions and 34 deletions

View File

@ -26,10 +26,10 @@ class Daemon(base.Daemon):
print(f'process for {project_name} {bot_name} is alive') print(f'process for {project_name} {bot_name} is alive')
continue continue
new_process = multiprocessing.Process(target=self.start_polling, args=[bot_info['secrets']['telegram_token'], bot_info['queue']]) 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}') print(f'starting process for {project_name} {bot_name} is alive')
new_process.start() new_process.start()
self.telegram_pollers[project_name][bot_name] = new_process self.telegram_pollers[project_name][bot_name] = new_process
print(f'started process for {project_name} {bot_name}') print(f'started process for {project_name} {bot_name} is alive')
else: else:
if process is None or not process.is_alive: if process is None or not process.is_alive:
print(f'process for {project_name} {bot_name} is not alive') print(f'process for {project_name} {bot_name} is not alive')

View File

@ -1,19 +0,0 @@
{
"configs": {
"bots": {
"pizda-bot": {
"telegram-bot": {
"type": "telegram",
"poll_enabled": true,
"mailbox_enabled": false,
"queue": "pizda_bot_worker",
"secrets": {
"telegram_token": "5652624181:AAFFVjcHJjea7wlW6MRaxjFY_eu2XWPwOns"
}
}
}
}
},
"experiments": {},
"platform_staff": {}
}

22
main.py
View File

@ -1,17 +1,15 @@
import sys import sys
# arg = sys.argv[-1] arg = sys.argv[-1]
arg = 'poll'
if __name__ == '__main__': if arg == "poll":
if arg == "poll": print("poll is starting")
print("poll is starting") from daemons.poll import Daemon
from daemons.poll import Daemon elif arg == 'mailbox':
elif arg == 'mailbox': print("mailbox is starting")
print("mailbox is starting") from daemons.mailbox import Daemon
from daemons.mailbox import Daemon else:
else: raise ValueError(f"Unknown param {arg}")
raise ValueError(f"Unknown param {arg}")
Daemon().execute() Daemon().execute()

View File

@ -88,6 +88,6 @@ class PlatformClient:
platform_client = PlatformClient( platform_client = PlatformClient(
'Botalka', 'Botalka',
os.getenv('STAGE', 'local'), os.getenv('STAGE'),
need_poll=True, need_poll=True,
) )