mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-16 20:29:55 +01:00
webhookhandler: Fix exception thrown during error handling (#985)
BaseServer.handle_error() default behaviour is to print to stdout or stderr (depends on the python version). In case that the file descriptor is closed an additional exception will be raised, causing the webhook thread to quit. Fixes #970
This commit is contained in:
parent
d6b47da593
commit
8690ba256e
1 changed files with 6 additions and 1 deletions
|
@ -62,12 +62,17 @@ class WebhookServer(BaseHTTPServer.HTTPServer, object):
|
|||
def shutdown(self):
|
||||
with self.shutdown_lock:
|
||||
if not self.is_running:
|
||||
self.logger.warn('Webhook Server already stopped.')
|
||||
self.logger.warning('Webhook Server already stopped.')
|
||||
return
|
||||
else:
|
||||
super(WebhookServer, self).shutdown()
|
||||
self.is_running = False
|
||||
|
||||
def handle_error(self, request, client_address):
|
||||
"""Handle an error gracefully."""
|
||||
self.logger.debug('Exception happened during processing of request from %s',
|
||||
client_address, exc_info=True)
|
||||
|
||||
|
||||
# WebhookHandler, process webhook calls
|
||||
# Based on: https://github.com/eternnoir/pyTelegramBotAPI/blob/master/
|
||||
|
|
Loading…
Add table
Reference in a new issue