mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
python: Accept Optional[FrameType] in signal handlers.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
7a9074ecfd
commit
702ce071f4
@@ -6,7 +6,7 @@ import threading
|
||||
from argparse import ArgumentParser
|
||||
from contextlib import contextmanager
|
||||
from types import FrameType
|
||||
from typing import Any, Iterator, List
|
||||
from typing import Any, Iterator, List, Optional
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
@@ -53,7 +53,7 @@ class Command(BaseCommand):
|
||||
logging.basicConfig()
|
||||
logger = logging.getLogger("process_queue")
|
||||
|
||||
def exit_with_three(signal: int, frame: FrameType) -> None:
|
||||
def exit_with_three(signal: int, frame: Optional[FrameType]) -> None:
|
||||
"""
|
||||
This process is watched by Django's autoreload, so exiting
|
||||
with status code 3 will cause this process to restart.
|
||||
@@ -91,7 +91,7 @@ class Command(BaseCommand):
|
||||
queue_name = options["queue_name"]
|
||||
worker_num = options["worker_num"]
|
||||
|
||||
def signal_handler(signal: int, frame: FrameType) -> None:
|
||||
def signal_handler(signal: int, frame: Optional[FrameType]) -> None:
|
||||
logger.info("Worker %d disconnecting from queue %s", worker_num, queue_name)
|
||||
worker.stop()
|
||||
sys.exit(0)
|
||||
|
||||
Reference in New Issue
Block a user