Includes atomic migrations, per-rule reminder semantics, first-run helper script and the note on the undecided UI chat idea. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
29 lines
1002 B
Python
29 lines
1002 B
Python
from dataclasses import dataclass
|
|
|
|
from ..constants import (ALERTS_DEFAULT_DELAY_MINUTES, ALERTS_HOST_DELAY_MINUTES, DEFAULT_DELAY_MINUTES,
|
|
DEFAULT_HOST_DELAY_MINUTES, DEFAULT_POLL_INTERVAL, MAX_DELAY_MINUTES, MIN_POLL_INTERVAL,
|
|
POLL_INTERVAL)
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class PollOptions:
|
|
interval: int
|
|
default_delay_minutes: int
|
|
host_delay_minutes: int = DEFAULT_HOST_DELAY_MINUTES
|
|
|
|
|
|
def read_default_delay(store) -> int:
|
|
return min(store.get_int(ALERTS_DEFAULT_DELAY_MINUTES, DEFAULT_DELAY_MINUTES), MAX_DELAY_MINUTES)
|
|
|
|
|
|
def read_host_delay(store) -> int:
|
|
return min(store.get_int(ALERTS_HOST_DELAY_MINUTES, DEFAULT_HOST_DELAY_MINUTES), MAX_DELAY_MINUTES)
|
|
|
|
|
|
def read_poll_options(store) -> PollOptions:
|
|
return PollOptions(
|
|
interval=store.get_int(POLL_INTERVAL, DEFAULT_POLL_INTERVAL, MIN_POLL_INTERVAL),
|
|
default_delay_minutes=read_default_delay(store),
|
|
host_delay_minutes=read_host_delay(store),
|
|
)
|