sleep delta to be ignored when it becomes > sleep_seconds
@@ -190,8 +190,9 @@ class Server(FoglampMicroservice):
key=data['key'],
readings=data['readings']))
delta = self._event_loop.time() - t1
- # If delta somehow becomes > sleep_seconds, then do not sleep
- await asyncio.sleep(sleep_seconds - delta)
+ # If delta somehow becomes > sleep_seconds, then ignore delta
+ sleep_for = sleep_seconds - delta if delta < sleep_seconds else sleep_seconds
+ await asyncio.sleep(sleep_for)
except asyncio.CancelledError:
pass
except KeyError as ex:
