Merge branch 'maintenance' into devel
This commit is contained in:
commit
7ee8c5d284
12 files changed
+1251
-2964
No files matched your search
+15
-15
@@ -158,18 +158,18 @@ jobs:
|
||||
password: ${{ secrets.testpypi_password }}
|
||||
repository_url: https://test.pypi.org/legacy/
|
||||
|
||||
#publish-on-pypi:
|
||||
# name: 📦 Publish tagged releases to PyPI
|
||||
# if: github.event_name == 'release'
|
||||
# needs: publish-on-testpypi
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: ⬇ Download build result
|
||||
# uses: actions/download-artifact@v1
|
||||
# with:
|
||||
# name: dist
|
||||
# path: dist
|
||||
# - name: 📦 Publish to index
|
||||
# uses: pypa/gh-action-pypi-publish@master
|
||||
# with:
|
||||
# password: ${{ secrets.pypi_password }}
|
||||
publish-on-pypi:
|
||||
name: 📦 Publish tagged releases to PyPI
|
||||
if: github.event_name == 'release'
|
||||
needs: publish-on-testpypi
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: ⬇ Download build result
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: dist
|
||||
path: dist
|
||||
- name: 📦 Publish to index
|
||||
uses: pypa/gh-action-pypi-publish@master
|
||||
with:
|
||||
password: ${{ secrets.pypi_password }}
|
||||
@@ -16,6 +16,9 @@ class AsyncLogHandlerMixin(logging.Handler):
|
||||
super(AsyncLogHandlerMixin, self).__init__(*args, **kwargs)
|
||||
|
||||
def emit(self, record):
|
||||
if getattr(self._executor, "_shutdown", False):
|
||||
return
|
||||
|
||||
try:
|
||||
self._executor.submit(self._emit, record)
|
||||
except Exception:
|
||||
@@ -25,6 +28,10 @@ class AsyncLogHandlerMixin(logging.Handler):
|
||||
# noinspection PyUnresolvedReferences
|
||||
super(AsyncLogHandlerMixin, self).emit(record)
|
||||
|
||||
def close(self):
|
||||
self._executor.shutdown(wait=True)
|
||||
super(AsyncLogHandlerMixin, self).close()
|
||||
|
||||
|
||||
class CleaningTimedRotatingFileHandler(logging.handlers.TimedRotatingFileHandler):
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ from octoprint.settings import valid_boolean_trues
|
||||
from octoprint.server.util.flask import no_firstrun_access, with_revalidation_checking, check_etag
|
||||
from octoprint.access import ADMIN_GROUP
|
||||
from octoprint.access.permissions import Permissions
|
||||
from octoprint.util import to_bytes, TemporaryDirectory
|
||||
from octoprint.util import to_bytes, to_native_str, TemporaryDirectory
|
||||
from octoprint.util.pip import LocalPipCaller
|
||||
from octoprint.util.version import get_octoprint_version_string, get_octoprint_version, is_octoprint_compatible, is_python_compatible
|
||||
from octoprint.util.platform import get_os, is_os_compatible
|
||||
@@ -429,7 +429,7 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin,
|
||||
if ext in PluginManagerPlugin.ARCHIVE_EXTENSIONS:
|
||||
return True
|
||||
|
||||
kind = filetype.guess(path)
|
||||
kind = filetype.guess(to_native_str(path))
|
||||
if kind:
|
||||
return ".{}".format(kind.extension) in PluginManagerPlugin.ARCHIVE_EXTENSIONS
|
||||
return False
|
||||
|
||||
@@ -102,6 +102,7 @@ class TrackingPlugin(octoprint.plugin.SettingsPlugin,
|
||||
if not self._settings.get_boolean(["enabled"]):
|
||||
return
|
||||
self._track_shutdown()
|
||||
self._executor.shutdown(wait=True)
|
||||
|
||||
##~~ EventHandlerPlugin
|
||||
|
||||
|
||||
@@ -903,6 +903,8 @@ class Server(object):
|
||||
observer.stop()
|
||||
observer.join()
|
||||
eventManager.fire(events.Events.SHUTDOWN)
|
||||
|
||||
self._logger.info("Calling on_shutdown on plugins")
|
||||
octoprint.plugin.call_plugin(octoprint.plugin.ShutdownPlugin,
|
||||
"on_shutdown",
|
||||
sorting_context="ShutdownPlugin.on_shutdown")
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large.
Load diff
+26
-14
@@ -2405,17 +2405,20 @@ class MachineCom(object):
|
||||
else:
|
||||
timeout = settings().getFloat(["serial", "timeout", "detection"])
|
||||
|
||||
def attempt_handshake():
|
||||
if self._serial.timeout != timeout:
|
||||
self._serial.timeout = timeout
|
||||
self._timeout = monotonic_time() + timeout
|
||||
|
||||
log("Handshake attempt #{}".format(self._detection_retry + 1))
|
||||
|
||||
self._detection_retry += 1
|
||||
self._do_send_without_checksum(b"", log=False) # new line to reset things
|
||||
self.sayHello(tags={"trigger:detection", })
|
||||
|
||||
while len(self._detection_candidates) > 0:
|
||||
if self._detection_retry < self.DETECTION_RETRIES:
|
||||
if self._serial.timeout != timeout:
|
||||
self._serial.timeout = timeout
|
||||
self._timeout = monotonic_time() + timeout
|
||||
|
||||
log("Handshake attempt #{}".format(self._detection_retry + 1))
|
||||
|
||||
self._detection_retry += 1
|
||||
self._do_send_without_checksum(b"", log=False) # new line to reset things
|
||||
self.sayHello(tags={"trigger:detection", })
|
||||
attempt_handshake()
|
||||
return
|
||||
|
||||
else:
|
||||
@@ -2429,13 +2432,12 @@ class MachineCom(object):
|
||||
else:
|
||||
self._serial.baudrate = b
|
||||
|
||||
if self._serial.timeout != timeout:
|
||||
self._serial.timeout = timeout
|
||||
self._timeout = monotonic_time() + timeout
|
||||
|
||||
log("Trying port {}, baudrate {}".format(p, b))
|
||||
self._detection_retry = 0
|
||||
|
||||
attempt_handshake()
|
||||
return
|
||||
|
||||
except Exception:
|
||||
self._log("Unexpected error while setting baudrate {}: {}".format(b, get_exception_string()))
|
||||
self._logger.exception("Unexpected error while setting baudrate {}".format(b))
|
||||
@@ -5023,7 +5025,7 @@ class BufferedReadlineWrapper(wrapt.ObjectProxy):
|
||||
timeout = serial.Timeout(self._timeout)
|
||||
|
||||
while not timeout.expired():
|
||||
self._buffered += self.read(min(self.in_waiting, 1))
|
||||
self._buffered += self.read(self.in_waiting)
|
||||
|
||||
# check for terminator, if it's there we have found our line
|
||||
termpos = self._buffered.find(terminator)
|
||||
@@ -5033,6 +5035,16 @@ class BufferedReadlineWrapper(wrapt.ObjectProxy):
|
||||
del self._buffered[:termpos + termlen]
|
||||
return bytes(line)
|
||||
|
||||
if timeout.expired():
|
||||
break
|
||||
|
||||
c = self.read(1)
|
||||
if not c:
|
||||
# EOF
|
||||
break
|
||||
|
||||
self._buffered += c
|
||||
|
||||
return b""
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ describe('Connection test against virtual printer', () => {
|
||||
.should('contain', 'Connect')
|
||||
.click();
|
||||
|
||||
cy.get('#connection .accordion-inner')
|
||||
cy.get('#connection .accordion-inner', {timeout: 10000})
|
||||
.should('not.be.visible');
|
||||
cy.get('#state .accordion-inner strong:first')
|
||||
.should('contain', 'Operational');
|
||||
|
||||
@@ -2,6 +2,20 @@ describe('Login tests', () => {
|
||||
const username = 'admin';
|
||||
const password = 'test';
|
||||
|
||||
it('ensure cache hit', () => {
|
||||
// login
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: '/api/login',
|
||||
body: {
|
||||
"user": username,
|
||||
"pass": password
|
||||
}
|
||||
});
|
||||
|
||||
cy.visit('/');
|
||||
});
|
||||
|
||||
context('Successful login', () => {
|
||||
it('logs in', () => {
|
||||
cy.visit('/');
|
||||
|
||||
Binary file not shown.
+855
-2614
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user