3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-11 20:49:33 +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 """Deinitialize PyLink Relay by quitting all relay clients and saving the
relay DB.""" relay DB."""
# For every connected network: if not world.shutting_down.is_set():
for ircobj in world.networkobjects.values(): # Speed up shutdowns significantly by not manually splitting off every relay server -
# 1) SQUIT every relay subserver. # the connection will soon be gone anyways.
for server, sobj in ircobj.servers.copy().items():
if hasattr(sobj, 'remote'): # For every connected network:
ircobj.proto.squit(ircobj.sid, server, text="Relay plugin unloaded.") 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. # 2) Clear our internal servers and users caches.
relayservers.clear() relayservers.clear()