From 61ec5bd5b785f3ff45eb733bf388af7296ddd75f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 14 Mar 2022 09:59:05 +0100 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=90=9B=20GCV:=20Fix=20pending=20file?= =?UTF-8?q?=20position=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we strip \r from \r\n, our line length and thus file position calculation will be off by one. We'll just leave it in as it doesn't influence our parsing and makes things way easier. Thanks to @JoveToo for the heads-up on Discord. --- .../gcodeviewer/static/js/viewer/reader.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js b/src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js index de056f2f9..bb15ba3d7 100644 --- a/src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js +++ b/src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js @@ -54,7 +54,7 @@ GCODE.gCodeReader = (function () { byteCount = 0; for (i = 0; i < lines.length; i++) { - byteCount += lines[i].length + 1; // line length + line ending + byteCount += lines[i].length + 1; // line length + '\n' gcode.push({line: lines[i], percentage: (byteCount * 100) / totalSize}); } lines = []; @@ -188,8 +188,21 @@ GCODE.gCodeReader = (function () { this.clear(); var totalSize = reader.target.result.length; - // With a regex split below as previous, memory usage is huge & takes longer. - lines = reader.target.result.replace("\r\n", "\n").split("\n"); + + /* + * Split by line ending + * + * Note that for windows line endings \r\n this leaves the \r attached to + * the lines. That will not influence our parser, but makes file position + * calculation way easier (line length + 1), so we just leave it in. + * + * This cannot cope with old MacOS \r line endings, but those should + * really not be used anymore and thus we'll happily ignore them here. + * + * A simple string split uses up *much* less memory than regex. + */ + lines = reader.target.result.split("\n"); + reader.target.result = null; prepareGCode(totalSize); From 5f8dfdfe937e59614ca30dd54f5a0ad8af3e92e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 14 Mar 2022 10:00:21 +0100 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=92=A1=20GCV:=20Slight=20rephrasing?= =?UTF-8?q?=20of=20a=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js b/src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js index bb15ba3d7..a4c1876d0 100644 --- a/src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js +++ b/src/octoprint/plugins/gcodeviewer/static/js/viewer/reader.js @@ -192,14 +192,14 @@ GCODE.gCodeReader = (function () { /* * Split by line ending * - * Note that for windows line endings \r\n this leaves the \r attached to + * Be aware that for windows line endings \r\n this leaves the \r attached to * the lines. That will not influence our parser, but makes file position * calculation way easier (line length + 1), so we just leave it in. * * This cannot cope with old MacOS \r line endings, but those should * really not be used anymore and thus we'll happily ignore them here. * - * A simple string split uses up *much* less memory than regex. + * Note: A simple string split uses up *much* less memory than regex. */ lines = reader.target.result.split("\n"); From 5a65946d3701bdc9ed213b1d28254180613476de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 14 Mar 2022 11:22:30 +0100 Subject: [PATCH 3/6] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Depend=20on=20watchdog?= =?UTF-8?q?=201.x=20instead=20of=201.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index aa896dd96..5b143e772 100644 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ core_deps = [ "semantic_version>=2.8.5,<3", "sentry-sdk>=1.3.1,<2", "tornado>=6.0.4,<7", - "watchdog==1.0.0", + "watchdog>=1,<2", "websocket-client>=1.2.1,<2", "wrapt>=1.13.3,<1.14", "zeroconf>=0.33,<0.34", # breaking changes can happen on minor version increases From fa2c4680cca0d1d6b46e6c1ed68ceea4d9b79afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 14 Mar 2022 12:00:35 +0100 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=94=87=20Less=20scary=20log=20on=20in?= =?UTF-8?q?valid=20announcement=20cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/octoprint/plugins/announcements/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/octoprint/plugins/announcements/__init__.py b/src/octoprint/plugins/announcements/__init__.py index 149ee90b6..82ea66c2b 100644 --- a/src/octoprint/plugins/announcements/__init__.py +++ b/src/octoprint/plugins/announcements/__init__.py @@ -4,6 +4,7 @@ __copyright__ = "Copyright (C) 2016 The OctoPrint Project - Released under terms import calendar +import logging import os import re import threading @@ -436,9 +437,11 @@ class AnnouncementPlugin( self._logger.debug(f"Loaded channel {key} from cache at {channel_path}") return d except Exception: - self._logger.exception( - f"Could not read channel {key} from cache {channel_path}" - ) + if self._logger.isEnabledFor(logging.DEBUG): + self._logger.exception( + f"Could not read channel {key} from cache at {channel_path}" + ) + try: os.remove(channel_path) except OSError: From 4a3b50cd3ede3670067452b3b9ef5a33992d2668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 14 Mar 2022 12:29:32 +0100 Subject: [PATCH 5/6] =?UTF-8?q?=F0=9F=94=96=20staging/maintenance=20is=20n?= =?UTF-8?q?ow=201.8.0rc2.dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .versioneer-lookup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.versioneer-lookup b/.versioneer-lookup index f897bb16c..91336649f 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -29,10 +29,10 @@ improve/.* 1.8.0 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev staging/bugfix 1.7.4 59cbfadf8922d85b9df40f8d0173e8c21724c3b8 pep440-dev bug/.* 1.7.4 59cbfadf8922d85b9df40f8d0173e8c21724c3b8 pep440-dev -# staging/maintenance is currently the branch for preparation of 1.7.0rc4 +# staging/maintenance is currently the branch for preparation of 1.8.0rc1 # so is regressionfix/... -staging/maintenance 1.7.0rc4 f31194f75365787f3eb5da61a24f2f8620111f4f pep440-dev -regressionfix/.* 1.7.0rc4 f31194f75365787f3eb5da61a24f2f8620111f4f pep440-dev +staging/maintenance 1.8.0rc1 fa2c4680cca0d1d6b46e6c1ed68ceea4d9b79afb pep440-dev +regressionfix/.* 1.8.0rc1 fa2c4680cca0d1d6b46e6c1ed68ceea4d9b79afb pep440-dev # staging/devel is currently inactive (but has the 1.4.1rc4 namespace) staging/devel 1.4.1rc4 650d54d1885409fa1d411eb54b9e8c7ff428910f pep440-dev From 1de39fc9d5d3e31c2c094cc75e71323ecc51a3bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 14 Mar 2022 12:30:36 +0100 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=94=96=20maintenance=20is=20now=201.9?= =?UTF-8?q?.0.dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .versioneer-lookup | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.versioneer-lookup b/.versioneer-lookup index 91336649f..7422f1293 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -18,11 +18,11 @@ prerelease HEAD \(detached.* -# maintenance is currently the branch for preparation of maintenance release 1.8.0 +# maintenance is currently the branch for preparation of maintenance release 1.9.0 # so are any fix/... and improve/... branches -maintenance 1.8.0 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev -fix/.* 1.8.0 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev -improve/.* 1.8.0 3fe45661cd79c5137d9d4f5f4adb4d9519bc2084 pep440-dev +maintenance 1.9.0 fa2c4680cca0d1d6b46e6c1ed68ceea4d9b79afb pep440-dev +fix/.* 1.9.0 fa2c4680cca0d1d6b46e6c1ed68ceea4d9b79afb pep440-dev +improve/.* 1.9.0 fa2c4680cca0d1d6b46e6c1ed68ceea4d9b79afb pep440-dev # staging/bugfix is the branch for preparation of the 1.7.4 bugfix release # so are any bug/... branches