provide comment as to why Live needs lock in process_renderables

This commit is contained in:
Nathan Page 2020-10-24 16:23:24 -04:00
parent 119211e37f
commit ae15cff503

View file

@ -156,7 +156,8 @@ class Live(JupyterMixin, RenderHook):
) -> List[ConsoleRenderable]: ) -> List[ConsoleRenderable]:
"""Process renderables to restore cursor and display progress.""" """Process renderables to restore cursor and display progress."""
if self.console.is_terminal: if self.console.is_terminal:
with self._lock: # need to ensure data is not updating in between # lock needs acquiring as user can modify live_render renerable at any time unlike in Progress.
with self._lock:
renderables = [ renderables = [
self._live_render.position_cursor(), self._live_render.position_cursor(),
*renderables, *renderables,