Skip to content

Commit

Permalink
Ensure that Stream triggering state is handled correctly on bokeh ser…
Browse files Browse the repository at this point in the history
…ver (#4041)
  • Loading branch information
philippjfr committed Oct 8, 2019
1 parent 2867d4a commit 6e8ad4d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion holoviews/plotting/bokeh/plot.py
Expand Up @@ -178,10 +178,23 @@ def _construct_callbacks(self):

def refresh(self, **kwargs):
if self.renderer.mode == 'server' and curdoc() is not self.document:
self._triggering += [s for p in self.traverse(lambda x: x, [Plot])
for s in p.streams if s._triggering]
# If we do not have the Document lock, schedule refresh as callback
self.document.add_next_tick_callback(self.refresh)
else:
return

for s in self._triggering:
s._triggering = True
try:
super(BokehPlot, self).refresh(**kwargs)
except Exception as e:
raise e
finally:
# Reset triggering state
for s in self._triggering:
s._triggering = False
self._triggering = []

def push(self):
"""
Expand Down
1 change: 1 addition & 0 deletions holoviews/plotting/plot.py
Expand Up @@ -245,6 +245,7 @@ def __init__(self, keys=None, dimensions=None, layout_dimensions=None,
self.comm = comm
self._force = False
self._updated = False # Whether the plot should be marked as updated
self._triggering = []
params = {k: v for k, v in params.items()
if k in self.params()}
super(DimensionedPlot, self).__init__(**params)
Expand Down

0 comments on commit 6e8ad4d

Please sign in to comment.