Skip to content

Commit

Permalink
Remove unused threading event
Browse files Browse the repository at this point in the history
  • Loading branch information
abersheeran committed Dec 15, 2023
1 parent 993e695 commit 29b3ad6
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions uvicorn/supervisors/multiprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def __init__(
self.processes: List[Process] = []

self.should_exit = threading.Event()
self.keep_alive_checking = threading.Event()

self.signal_queue: List[int] = []
for sig in UNIX_SIGNALS:
Expand Down Expand Up @@ -174,7 +173,6 @@ def run(self) -> None:
logger.info(message, extra={"color_message": color_message})

def keep_subprocess_alive(self) -> None:
self.keep_alive_checking.clear()
for idx, process in enumerate(tuple(self.processes)):
if process.is_alive():
continue
Expand All @@ -186,7 +184,6 @@ def keep_subprocess_alive(self) -> None:
process = Process(self.config, self.target, self.sockets)
process.start()
self.processes.append(process)
self.keep_alive_checking.set()

def handle_signals(self) -> None:
for sig in tuple(self.signal_queue):
Expand All @@ -202,23 +199,20 @@ def handle_int(self) -> None:
if not self.should_exit.is_set():
self.should_exit.set()
else:
self.keep_alive_checking.wait()
self.terminate_all()

def handle_term(self) -> None:
logger.info("Received SIGTERM, exiting")
if not self.should_exit.is_set():
self.should_exit.set()
else:
self.keep_alive_checking.wait()
self.terminate_all()

def handle_break(self) -> None:
logger.info("Received SIGBREAK, exiting")
if not self.should_exit.is_set():
self.should_exit.set()
else:
self.keep_alive_checking.wait()
self.terminate_all()

def handle_hup(self) -> None:
Expand Down

0 comments on commit 29b3ad6

Please sign in to comment.