Skip to content

Commit

Permalink
fix expire timer
Browse files Browse the repository at this point in the history
  • Loading branch information
doudz committed Jul 30, 2018
1 parent 8fe8191 commit 5a15f12
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions zigate/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,7 @@ def _set_expire_timer(self, endpoint_id, cluster_id, attribute_id, expire):
k = (endpoint_id, cluster_id, attribute_id)
timer = self._expire_timer.get(k)
if timer:
LOGGER.debug('Cancel previous Timer {}'.format(timer))
timer.cancel()
timer = threading.Timer(expire,
functools.partial(self._reset_attribute,
Expand All @@ -1557,6 +1558,7 @@ def _set_expire_timer(self, endpoint_id, cluster_id, attribute_id, expire):
attribute_id))
timer.setDaemon(True)
timer.start()
self._expire_timer[k] = timer

def _reset_attribute(self, endpoint_id, cluster_id, attribute_id):
attribute = self.get_attribute(endpoint_id,
Expand Down

0 comments on commit 5a15f12

Please sign in to comment.