From 5b70d409eda079700485c10b4e32bb4224ed45de Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 23 Oct 2019 09:46:44 +0200 Subject: [PATCH] Improve documentation for lazy-loading background task In particular the thread switching sleep was a bit mysterious. Contributes to issue CURA_6793. --- cura/Machines/ContainerTree.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cura/Machines/ContainerTree.py b/cura/Machines/ContainerTree.py index 5daae32826..6c4a0c3450 100644 --- a/cura/Machines/ContainerTree.py +++ b/cura/Machines/ContainerTree.py @@ -146,7 +146,10 @@ class ContainerTree: # # The ``JobQueue`` will schedule this on a different thread. def run(self) -> None: - for stack in self.container_stacks: + for stack in self.container_stacks: # Load all currently-added containers. + # Allow a thread switch after every container. + # Experimentally, sleep(0) didn't allow switching. sleep(0.1) or sleep(0.2) neither. + # We're in no hurry though. Half a second is fine. time.sleep(0.5) if not isinstance(stack, GlobalStack): continue