From b32232b46eaef7ef82ee65592be2efb0468ae739 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Wed, 1 Jul 2020 00:53:23 +0200 Subject: [PATCH] Prevent a tight loop in HttpPoll if one of the requests fails --- platypush/backend/http/poll/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platypush/backend/http/poll/__init__.py b/platypush/backend/http/poll/__init__.py index e176805f..facef9a8 100644 --- a/platypush/backend/http/poll/__init__.py +++ b/platypush/backend/http/poll/__init__.py @@ -73,7 +73,11 @@ class HttpPollBackend(Backend): while not self.should_stop(): for request in self.requests: if time.time() - request.last_request_timestamp > request.poll_seconds: - request.execute() + try: + request.execute() + except Exception as e: + self.logger.error('Error while executing request: {}'.format(request)) + self.logger.exception(e) time.sleep(0.1) # Prevent a tight loop