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

View file

@ -73,7 +73,11 @@ class HttpPollBackend(Backend):
while not self.should_stop(): while not self.should_stop():
for request in self.requests: for request in self.requests:
if time.time() - request.last_request_timestamp > request.poll_seconds: if time.time() - request.last_request_timestamp > request.poll_seconds:
try:
request.execute() 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 time.sleep(0.1) # Prevent a tight loop