From 7813f588851ae7eff74fe2aa1cbf28051499bf86 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Tue, 8 Oct 2019 12:44:06 +0200 Subject: [PATCH] Ensure that Stream triggering state is handled correctly on bokeh server (#4041) --- holoviews/plotting/bokeh/plot.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/holoviews/plotting/bokeh/plot.py b/holoviews/plotting/bokeh/plot.py index 8dd547e0bc..266cb60a88 100644 --- a/holoviews/plotting/bokeh/plot.py +++ b/holoviews/plotting/bokeh/plot.py @@ -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): """