diff --git a/src/octoprint/filemanager/analysis.py b/src/octoprint/filemanager/analysis.py index 5c92bd8b..f0c515b2 100644 --- a/src/octoprint/filemanager/analysis.py +++ b/src/octoprint/filemanager/analysis.py @@ -17,6 +17,7 @@ import collections import time from octoprint.events import Events, eventManager +from octoprint.settings import settings import octoprint.util.gcodeInterpreter as gcodeInterpreter @@ -306,11 +307,11 @@ class GcodeAnalysisQueue(AbstractAnalysisQueue): def _do_analysis(self, high_priority=False): try: - def throttle(): - time.sleep(0.01) - - throttle_callback = throttle - if high_priority: + throttle = settings().getFloat(["gcodeAnalysis", "throttle_highprio"]) if high_priority else settings().getFloat(["gcodeAnalysis", "throttle_normalprio"]) + if throttle > 0: + def throttle_callback(): + time.sleep(throttle) + else: throttle_callback = None self._gcode = gcodeInterpreter.gcode() diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index fc7998e7..fa50ba19 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -178,7 +178,9 @@ default_settings = { "sizeThreshold": 20 * 1024 * 1024, # 20MB }, "gcodeAnalysis": { - "maxExtruders": 10 + "maxExtruders": 10, + "throttle_normalprio": 0.01, + "throttle_highprio": 0.0 }, "feature": { "temperatureGraph": True,