Don't mutate server list while iterating on it.

It causes hanging at bot/test stops.
This commit is contained in:
Valentin Lorentz 2019-09-15 08:02:10 +02:00
parent 656222e341
commit 40837dbda0
1 changed files with 1 additions and 1 deletions

View File

@ -468,7 +468,7 @@ def unhook(subdir):
"""Unsets the callback assigned to the given subdir, and return it."""
global http_servers
assert isinstance(http_servers, list)
for server in http_servers:
for server in list(http_servers):
server.unhook(subdir)
if len(server.callbacks) <= 0 and not configGroup.keepAlive():
server.shutdown()