Skip to content

Commit

Permalink
increment periodic callback counter before executing callback; update…
Browse files Browse the repository at this point in the history
… logic to signal a stop (#5344)
  • Loading branch information
Lnk2past authored Aug 17, 2023
1 parent a6147b3 commit 3479cc2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions panel/io/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ def _exec_callback(self, post=False):
from .state import set_curdoc
try:
with set_curdoc(self._doc):
cb = self.callback()
if self.running:
self.counter += 1
if self.counter > self.count:
self.stop()
cb = self.callback() if self.running else None
except Exception:
cb = None
if post:
Expand All @@ -98,7 +102,6 @@ def _post_callback(self):
if not self._background:
with edit_readonly(state):
state._busy_counter -= 1
self.counter += 1
if self.timeout is not None:
dt = (time.time() - self._start_time) * 1000
if dt > self.timeout:
Expand Down

0 comments on commit 3479cc2

Please sign in to comment.