Skip to content

Commit

Permalink
Ensure busy state is reset after errors (#1518)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Aug 6, 2020
1 parent 304da6c commit 0603c36
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 8 additions & 1 deletion panel/io/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import time
import param

from ..util import edit_readonly
from .state import state


Expand Down Expand Up @@ -60,7 +61,13 @@ def _update_period(self):
self.start()

def _periodic_callback(self):
self.callback()
with edit_readonly(state):
state.busy = True
try:
self.callback()
finally:
with edit_readonly(state):
state.busy = False
self._counter += 1
if self.timeout is not None:
dt = (time.time() - self._start_time) * 1000
Expand Down
10 changes: 6 additions & 4 deletions panel/reactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,12 @@ def _param_change(self, *events):
def _process_events(self, events):
with edit_readonly(state):
state.busy = True
with edit_readonly(self):
self.param.set_param(**self._process_property_change(events))
with edit_readonly(state):
state.busy = False
try:
with edit_readonly(self):
self.param.set_param(**self._process_property_change(events))
finally:
with edit_readonly(state):
state.busy = False

@gen.coroutine
def _change_coroutine(self, doc=None):
Expand Down

0 comments on commit 0603c36

Please sign in to comment.