Gracefully handle a pending logging connection during shutdown. (#8685)

This commit is contained in:
Patrick Cloke authored and GitHub committed 2020-10-29 12:53:57 -04:00
1 parent f21e24ffc2
commit 8b42a4eefd
5 files changed
+36 -10

No files matched your search

+16
View File
@@ -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()