From d47ea73dfc59ce37c766e28c40bf545cff6c6f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 22 Jul 2020 14:31:50 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Only=20ever=20send=201=20line=20?= =?UTF-8?q?on=20continue=5Fsending?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise we might spam our send queue leading to a bunch of lines piling up inside it, making cancelling/pausing take longer and longer. Potential fix for #3649 --- src/octoprint/util/comm.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 4f2408606..831fade1a 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -2486,8 +2486,10 @@ class MachineCom(object): self._heating = False def _continue_sending(self): - while self._active: - job_active = self._state in (self.STATE_STARTING, self.STATE_PRINTING) and not (self._currentFile is None or self._currentFile.done or self.isSdPrinting()) + # Ensure we have at least one line in the send queue, but don't spam it + while self._active and not self._send_queue.qsize(): + job_active = self._state in (self.STATE_STARTING, self.STATE_PRINTING) \ + and not (self._currentFile is None or self._currentFile.done or self.isSdPrinting()) if self._send_from_command_queue(): # we found something in the command queue to send