Let shutdown return immediately if server is not running

This commit is contained in:
Jannes Höke 2015-11-21 21:22:11 +01:00
parent 0cd7aa92ae
commit 7c9928c58f

View file

@ -20,6 +20,17 @@ class WebhookServer(BaseHTTPServer.HTTPServer, object):
RequestHandlerClass)
self.update_queue = update_queue
self.webhook_path = webhook_path
self.is_running = False
def serve_forever(self, poll_interval=0.5):
self.is_running = True
super(WebhookServer, self).serve_forever(poll_interval)
def shutdown(self):
if not self.is_running:
return
else:
super(WebhookServer, self).shutdown()
# WebhookHandler, process webhook calls