Files
syncio/app/worker.py
brusnitsyn b5d1f61a82 v2026.06
2026-06-10 16:53:03 +09:00

27 lines
595 B
Python

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, 1800.0))
if __name__ == "__main__":
main()