first commit

This commit is contained in:
brusnitsyn
2026-04-16 17:57:58 +09:00
commit 7a13ff3b74
22 changed files with 3319 additions and 0 deletions

26
app/worker.py Normal file
View File

@@ -0,0 +1,26 @@
import signal
import time
from .config import Config
from .queue import migration_queue
def main():
"""Запуск отдельного worker-процесса очереди и расписаний."""
stop_requested = False
def request_stop(_signum, _frame):
nonlocal stop_requested
stop_requested = True
signal.signal(signal.SIGINT, request_stop)
signal.signal(signal.SIGTERM, request_stop)
migration_queue.start()
while not stop_requested:
time.sleep(max(Config.QUEUE_POLL_SECONDS, 1.0))
if __name__ == "__main__":
main()