🐛 Make octoprint.util.ResettableTimer daemon thread by default
See also: * https://github.com/j7126/OctoPrint-Dashboard/pull/219 * https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/pull/200 Affects plugins that use multiprocessing, since it blocks the shutdown (and release of server address binding), breaking the server. Shouldn't be a breaking change, since it should be run daemon=True anyway to avoid the shutdown problems.
This commit is contained in:
1 parent
559c9b4e52
commit
aba033ae63
1 file changed
+2
-1
@@ -1456,7 +1456,7 @@ class ResettableTimer(threading.Thread):
|
||||
on_reset (callable): Callback to call when the timer is reset.
|
||||
"""
|
||||
|
||||
def __init__(self, interval, function, args=None, kwargs=None, on_reset=None, on_cancelled=None):
|
||||
def __init__(self, interval, function, args=None, kwargs=None, on_reset=None, on_cancelled=None, daemon=True):
|
||||
threading.Thread.__init__(self)
|
||||
self._event = threading.Event()
|
||||
self._mutex = threading.Lock()
|
||||
@@ -1473,6 +1473,7 @@ class ResettableTimer(threading.Thread):
|
||||
self.kwargs = kwargs
|
||||
self.on_cancelled = on_cancelled
|
||||
self.on_reset = on_reset
|
||||
self.daemon = daemon
|
||||
|
||||
|
||||
def run(self):
|
||||
|
||||
Reference in new issue
Block a user