Prevent a tight loop in HttpPoll if one of the requests fails

This commit is contained in:
Fabio Manganiello 2020-07-01 00:53:23 +02:00
parent 3174db5776
commit b32232b46e
1 changed files with 5 additions and 1 deletions

View File

@ -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