From 639619ff939c00befadbc5ded213200cae431a9c Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Mon, 9 Jan 2017 08:51:52 -0600 Subject: [PATCH] Partially revert 57de36a --- src/octoprint/server/__init__.py | 3 +-- src/octoprint/server/util/tornado.py | 30 ---------------------------- 2 files changed, 1 insertion(+), 32 deletions(-) diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index 4c60edc94..e9a432c70 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -168,8 +168,7 @@ class Server(object): self._logger = logging.getLogger(__name__) pluginManager = self._plugin_manager - # monkey patch a bunch of stuff - util.tornado.fix_ioloop_scheduling() + # monkey patch some stuff util.flask.enable_additional_translations(additional_folders=[self._settings.getBaseFolder("translations")]) # setup app diff --git a/src/octoprint/server/util/tornado.py b/src/octoprint/server/util/tornado.py index e599d1510..8325bcaf5 100644 --- a/src/octoprint/server/util/tornado.py +++ b/src/octoprint/server/util/tornado.py @@ -29,36 +29,6 @@ import tornado.util import octoprint.util -#~~ Monkey patching - - -def fix_ioloop_scheduling(): - """ - This monkey patches tornado's :meth:``tornado.ioloop.PeriodicCallback._schedule_next`` method so it no longer - blocks for long times on slow machines (RPi) when the system time happens to change by a large amount (e.g. due to - the first ever contact to an NTP server). - - Patch by @nosyjoe on Github. See this PR against tornado: https://github.com/tornadoweb/tornado/pull/1290 - """ - - import math - - # patched implementation taken from PR - def _schedule_next(self): - if self._running: - current_time = self.io_loop.time() - - if self._next_timeout <= current_time: - callback_time_sec = self.callback_time / 1000.0 - self._next_timeout += (math.floor((current_time - self._next_timeout) / callback_time_sec) + 1) * callback_time_sec - - self._timeout = self.io_loop.add_timeout(self._next_timeout, self._run) - - # replace original implementation with patched version - import tornado.ioloop - tornado.ioloop.PeriodicCallback._schedule_next = _schedule_next - - #~~ WSGI middleware