Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
nggit committed Dec 19, 2024
1 parent 8c13c06 commit 7a31eb6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tremolo/tremolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def _worker(self, host, port, **kwargs):
signal.signal(signal.SIGTERM, lambda signum, frame: task.cancel())

try:
self.loop.run_forever()
self.loop.run_forever() # until loop.stop() is called
finally:
try:
if not task.cancelled():
Expand Down Expand Up @@ -697,7 +697,9 @@ def run(self, host=None, port=0, reuse_port=True, worker_num=1, **kwargs):

print('-' * terminal_width)
print('%s main (pid %d) is running ' % (server_name, os.getpid()))
self.manager.wait(timeout=kwargs['shutdown_timeout'])

for sock in socks.values():
self.close_sock(sock)
try:
self.manager.wait(timeout=kwargs['shutdown_timeout'])
finally:
for sock in socks.values():
self.close_sock(sock)

0 comments on commit 7a31eb6

Please sign in to comment.