#479 - Fixing reminder stop
- Setting daemon on timer to True to make timer thread cancelable - Refactoring shutdown to use super instead of static super - Removing cleanuppull/446/merge
parent
6b324c6df2
commit
672b208b86
|
@ -270,10 +270,9 @@ class MycroftSkill(object):
|
|||
passed_time = time.time() - self.stop_time
|
||||
return passed_time < self.stop_threshold
|
||||
|
||||
def cleanup(self):
|
||||
""" Clean up running threads, etc. """
|
||||
pass
|
||||
|
||||
def shutdown(self):
|
||||
"""
|
||||
This method is intended to be called during the skill process termination.
|
||||
The skill implementation must shutdown all processes and operations in execution.
|
||||
"""
|
||||
self.stop()
|
||||
pass
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
|
||||
import json
|
||||
|
||||
import sys
|
||||
from os.path import expanduser, exists
|
||||
|
||||
from mycroft.configuration import ConfigurationManager
|
||||
|
@ -84,4 +86,6 @@ if __name__ == "__main__":
|
|||
except KeyboardInterrupt:
|
||||
for skill in skills:
|
||||
skill.shutdown()
|
||||
finally:
|
||||
sys.exit()
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ class ScheduledSkill(MycroftSkill):
|
|||
now = self.get_utc_time()
|
||||
delay = max(float(t) - now, 1)
|
||||
self.timer = Timer(delay, self.notify, [t])
|
||||
self.timer.daemon = True
|
||||
self.start()
|
||||
|
||||
def start(self):
|
||||
|
@ -113,15 +114,9 @@ class ScheduledSkill(MycroftSkill):
|
|||
def notify(self, timestamp):
|
||||
pass
|
||||
|
||||
def cleanup(self):
|
||||
""" Cancel timer making the skill ready for shutdown """
|
||||
if self.timer:
|
||||
self.timer.cancel()
|
||||
|
||||
def shutdown(self):
|
||||
MycroftSkill.shutdown(self)
|
||||
if self.timer:
|
||||
self.timer.cancel()
|
||||
super(ScheduledSkill, self).shutdown()
|
||||
self.cancel()
|
||||
|
||||
|
||||
class ScheduledCRUDSkill(ScheduledSkill):
|
||||
|
|
Loading…
Reference in New Issue