Skip to content

Commit

Permalink
Merge pull request #503 from kytos-ng/feat/shutdown
Browse files Browse the repository at this point in the history
Stop execute to be triggered one last time
  • Loading branch information
viniarck authored Oct 3, 2024
2 parents 9e5d25f + c2a0950 commit 87185cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes to the kytos project will be documented in this file.
UNRELEASED - Under development
******************************

Fixed
=====
- Execute routines like consistency checks will not trigger one more time after kytos shuts down.

[2024.1.2] - 2024-09-16
***********************

Expand Down
6 changes: 4 additions & 2 deletions kytos/core/napps/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,10 @@ def run(self):
except Exception:
traceback_str = traceback.format_exc(chain=False)
LOG.error(f"NApp: {self} unhandled exception {traceback_str}")
while self.__interval > 0 and not self.__event.is_set():
while self.__interval > 0:
self.__event.wait(self.__interval)
if self.__event.is_set():
break
try:
self.execute()
except Exception:
Expand All @@ -276,8 +278,8 @@ def _shutdown_handler(self, event): # pylint: disable=unused-argument
event (:class:`KytosEvent`): event to be listened.
"""
if not self.__event.is_set():
self.__event.set()
self.shutdown()
self.__event.set()

@abstractmethod
def setup(self):
Expand Down

0 comments on commit 87185cd

Please sign in to comment.