Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure busy state is reset after errors #1518

Merged
merged 1 commit into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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