3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-03 16:39:25 +01:00

relay: speed up shutdowns by not manually splitting off every relay server

The connection will soon be gone anyways, so this is fairly pointless.
This commit is contained in:
James Lu 2018-03-30 12:06:45 -07:00
parent c978e1c52f
commit 9d21a5269f

View File

@ -73,12 +73,16 @@ def die(irc=None):
"""Deinitialize PyLink Relay by quitting all relay clients and saving the
relay DB."""
# For every connected network:
for ircobj in world.networkobjects.values():
# 1) SQUIT every relay subserver.
for server, sobj in ircobj.servers.copy().items():
if hasattr(sobj, 'remote'):
ircobj.proto.squit(ircobj.sid, server, text="Relay plugin unloaded.")
if not world.shutting_down.is_set():
# Speed up shutdowns significantly by not manually splitting off every relay server -
# the connection will soon be gone anyways.
# For every connected network:
for ircobj in world.networkobjects.values():
# 1) SQUIT every relay subserver.
for server, sobj in ircobj.servers.copy().items():
if hasattr(sobj, 'remote'):
ircobj.proto.squit(ircobj.sid, server, text="Relay plugin unloaded.")
# 2) Clear our internal servers and users caches.
relayservers.clear()