Clean up log file output and fix some bugs. Swallows spammy and useless AMP connection errors.
This commit is contained in:
parent
86c970eb62
commit
76a903119c
4 changed files with 17 additions and 5 deletions
|
|
@ -118,8 +118,8 @@ class CmdShutdown(COMMAND_DEFAULT_CLASS):
|
||||||
announcement += "%s\n" % self.args
|
announcement += "%s\n" % self.args
|
||||||
logger.log_info('Server shutdown by %s.' % self.caller.name)
|
logger.log_info('Server shutdown by %s.' % self.caller.name)
|
||||||
SESSIONS.announce_all(announcement)
|
SESSIONS.announce_all(announcement)
|
||||||
SESSIONS.portal_shutdown()
|
|
||||||
SESSIONS.server.shutdown(mode='shutdown')
|
SESSIONS.server.shutdown(mode='shutdown')
|
||||||
|
SESSIONS.portal_shutdown()
|
||||||
|
|
||||||
|
|
||||||
class CmdPy(COMMAND_DEFAULT_CLASS):
|
class CmdPy(COMMAND_DEFAULT_CLASS):
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,6 @@ class AmpClientFactory(protocol.ReconnectingClientFactory):
|
||||||
reason (str): Eventual text describing why connection failed.
|
reason (str): Eventual text describing why connection failed.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
print ("portal retrying connection"), self.maxDelay
|
|
||||||
if hasattr(self, "server_restart_mode"):
|
if hasattr(self, "server_restart_mode"):
|
||||||
self.maxDelay = 2
|
self.maxDelay = 2
|
||||||
else:
|
else:
|
||||||
|
|
@ -372,6 +371,19 @@ class AMPProtocol(amp.AMP):
|
||||||
if hasattr(self.factory, "server_restart_mode"):
|
if hasattr(self.factory, "server_restart_mode"):
|
||||||
del self.factory.server_restart_mode
|
del self.factory.server_restart_mode
|
||||||
|
|
||||||
|
def connectionLost(self, reason):
|
||||||
|
"""
|
||||||
|
We swallow connection errors here. The reason is that during a
|
||||||
|
normal reload/shutdown there will almost always be cases where
|
||||||
|
either the portal or server shuts down before a message has
|
||||||
|
returned its (empty) return, triggering a connectionLost error
|
||||||
|
that is irrelevant. If a true connection error happens, the
|
||||||
|
portal will continuously try to reconnect, showing the problem
|
||||||
|
that way.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Error handling
|
# Error handling
|
||||||
|
|
||||||
def errback(self, e, info):
|
def errback(self, e, info):
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ class PortalSessionHandler(SessionHandler):
|
||||||
# sessions while we are looping over them.
|
# sessions while we are looping over them.
|
||||||
sessionhandler._disconnect_all = True
|
sessionhandler._disconnect_all = True
|
||||||
for session in sessionhandler.values():
|
for session in sessionhandler.values():
|
||||||
session.disconnect(session)
|
session.disconnect()
|
||||||
del sessionhandler._disconnect_all
|
del sessionhandler._disconnect_all
|
||||||
|
|
||||||
# inform Server; wait until finished sending before we continue
|
# inform Server; wait until finished sending before we continue
|
||||||
|
|
|
||||||
|
|
@ -657,8 +657,8 @@ class ServerSessionHandler(SessionHandler):
|
||||||
message (str): Message to send.
|
message (str): Message to send.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
for sess in self.values():
|
for session in self.values():
|
||||||
self.data_out(sess, text=message)
|
self.data_out(session, text=message)
|
||||||
|
|
||||||
def data_out(self, session, **kwargs):
|
def data_out(self, session, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue