Skip to content

Commit

Permalink
Merge pull request #69 from dumpfheimer/heartbeat_fix
Browse files Browse the repository at this point in the history
reset heartbeat on .start()
  • Loading branch information
Julius2342 authored Jun 30, 2021
2 parents bb748d1 + 9b032f9 commit ed8f7d2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyvlx/heartbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __del__(self):

def start(self):
"""Create loop task."""
self.stopped = False
self.run_task = self.pyvlx.loop.create_task(self.loop())

async def stop(self):
Expand All @@ -42,7 +43,10 @@ async def loop(self):
await self.loop_event.wait()
if not self.stopped:
self.loop_event.clear()
await self.pulse()
try:
await self.pulse()
except PyVLXException as e:
pass
self.cancel_loop_timeout()
self.stopped_event.set()

Expand Down

0 comments on commit ed8f7d2

Please sign in to comment.