mirror of
https://github.com/element-hq/synapse.git
synced 2026-10-23 06:32:54 +00:00
Gracefully handle a pending logging connection during shutdown. (#8685)
This commit is contained in:
1 parent
f21e24ffc2
commit
8b42a4eefd
5 files changed
+36
-10
No files matched your search
@@ -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()
|
||||
Reference in new issue
Block a user