Skip to content

Commit

Permalink
Speed up checks when verification fails
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Mar 26, 2024
1 parent 7c4d1e4 commit e333c21
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/lvmnps/actor/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
AnyPath = str | PathLike[str]


CHECK_INTERVAL: float = 30

NPSErrorCodes = create_error_codes(
{
"VERIFICATION_FAILED": ErrorData(
Expand Down Expand Up @@ -102,6 +104,9 @@ def __init__(

self.nps = get_nps_from_config(self.config)

self.restart_after = 30
self.restart_mode = "exit"

async def start(self, **kwargs): # pragma: no cover
"""Starts the actor."""

Expand All @@ -124,8 +129,10 @@ async def _check_internal(self):
if result is False:
raise VerificationError("NPS verification failed.")
except Exception as err:
self.check_interval = 5 # Speed up checks
raise CheckError(str(err), error_code=NPSErrorCodes.VERIFICATION_FAILED)

self.check_interval = CHECK_INTERVAL
return True

async def _troubleshoot_internal(
Expand Down

0 comments on commit e333c21

Please sign in to comment.