Skip to content

Commit

Permalink
chore: start and stop of cron scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Apr 13, 2024
1 parent 3e93c7d commit 30396ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/appier/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,7 @@ def start(self, refresh=True):
self._start_controllers()
self._start_models()
self._start_supervisor()
self._start_cron()
if refresh:
self.refresh()
self.status = RUNNING
Expand All @@ -745,6 +746,7 @@ def stop(self, refresh=True):
self._print_bye()
if refresh:
self.refresh()
self._stop_cron()
self._stop_supervisor()
self._stop_models()
self._stop_controllers()
Expand Down Expand Up @@ -5384,6 +5386,16 @@ def _start_supervisor(self):
def _stop_supervisor(self):
pass

def _start_cron(self):
pass

def _stop_cron(self):
if not self._cron:
return
self._cron.stop()
self._cron.join()
self._cron = None

def _add_route(self, *args, **kwargs):
self.__routes.append(args)
self.clear_routes()
Expand Down
4 changes: 3 additions & 1 deletion src/appier/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ def run(self):
self._condition.wait(self.timeout)
self._condition.release()

def stop(self):
def stop(self, awake=True):
self.running = False
if awake:
self.awake()

def tick(self):
pass
Expand Down

0 comments on commit 30396ad

Please sign in to comment.