Possible workaround for OctoPrint stalling when a clock change happens while it is running
This commit is contained in:
parent
e899050517
commit
ec7feb1a3c
2 changed files with 15 additions and 2 deletions
4
setup.py
4
setup.py
|
|
@ -289,6 +289,10 @@ def params():
|
|||
zip_safe = False
|
||||
install_requires = open("requirements.txt").read().split("\n")
|
||||
|
||||
import sys
|
||||
if sys.platform in ("linux2", "darwin"):
|
||||
install_requires += ["monotime"]
|
||||
|
||||
entry_points = {
|
||||
"console_scripts": [
|
||||
"octoprint = octoprint:main"
|
||||
|
|
|
|||
|
|
@ -575,6 +575,17 @@ class Server():
|
|||
app.register_blueprint(blueprint, url_prefix=url_prefix)
|
||||
logger.debug("Registered API of plugin {name} under URL prefix {url_prefix}".format(name=name, url_prefix=url_prefix))
|
||||
|
||||
## Tornado initialization starts here
|
||||
|
||||
try:
|
||||
import monotime
|
||||
import time
|
||||
ioloop = IOLoop(time_func=time.monotonic)
|
||||
except:
|
||||
import time
|
||||
ioloop = IOLoop(time_func=time.time)
|
||||
ioloop.install()
|
||||
|
||||
self._router = SockJSRouter(self._createSocketConnection, "/sockjs")
|
||||
|
||||
upload_suffixes = dict(name=settings().get(["server", "uploads", "nameSuffix"]), path=settings().get(["server", "uploads", "pathSuffix"]))
|
||||
|
|
@ -604,8 +615,6 @@ class Server():
|
|||
observer.schedule(util.watchdog.GcodeWatchdogHandler(fileManager, printer), settings().getBaseFolder("watched"))
|
||||
observer.start()
|
||||
|
||||
ioloop = IOLoop.instance()
|
||||
|
||||
# run our startup plugins
|
||||
octoprint.plugin.call_plugin(octoprint.plugin.StartupPlugin,
|
||||
"on_startup",
|
||||
|
|
|
|||
Loading…
Reference in a new issue