From 5eea285d0987cc30c41cb87e02a31683e79e00dd Mon Sep 17 00:00:00 2001 From: Humorous Baby Date: Fri, 7 Aug 2020 23:46:32 -0400 Subject: [PATCH] webhook: fix error on reconnect The bot runs plugin `shutdown`s on disconnect from the IRC server. While this method stops serving requests it doesn't actually close the socket; the restarted webserver cannot then bind to the same host/port in order to listen+serve requests. This results in a `OSError: [Errno 98] Address already in use`. To avoid this, the server needs to be closed after `shutdown`. As of this commit, the fix is valid for all Python>=2.7,>=3.5. --- sopel_modules/github/webhook.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sopel_modules/github/webhook.py b/sopel_modules/github/webhook.py index 2fe594f..04d7323 100644 --- a/sopel_modules/github/webhook.py +++ b/sopel_modules/github/webhook.py @@ -99,6 +99,7 @@ def log_request(*args, **kw): def stop(self): self.server.shutdown() + self.server.server_close() def get_targets(repo):