mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 00:54:47 -04:00
Gracefully handle a pending logging connection during shutdown. (#8685)
This commit is contained in:
parent
f21e24ffc2
commit
8b42a4eefd
5 changed files with 36 additions and 10 deletions
|
@ -151,3 +151,19 @@ class RemoteHandlerTestCase(LoggerCleanupMixin, TestCase):
|
|||
+ ["warn %s" % (i,) for i in range(15, 20)],
|
||||
logs,
|
||||
)
|
||||
|
||||
def test_cancel_connection(self):
|
||||
"""
|
||||
Gracefully handle the connection being cancelled.
|
||||
"""
|
||||
handler = RemoteHandler(
|
||||
"127.0.0.1", 9000, maximum_buffer=10, _reactor=self.reactor
|
||||
)
|
||||
logger = self.get_logger(handler)
|
||||
|
||||
# Send a message.
|
||||
logger.info("Hello there, %s!", "wally")
|
||||
|
||||
# Do not accept the connection and shutdown. This causes the pending
|
||||
# connection to be cancelled (and should not raise any exceptions).
|
||||
handler.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue