27 lines
592 B
Python
27 lines
592 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, 1.0))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|