Add historical UI and backend API slice
This commit is contained in:
@@ -12,6 +12,9 @@ DEFAULT_STORAGE_FILENAME = "hll_vietnam_dev.sqlite3"
|
||||
DEFAULT_REFRESH_INTERVAL_SECONDS = 120
|
||||
DEFAULT_HISTORICAL_CRCON_PAGE_SIZE = 50
|
||||
DEFAULT_HISTORICAL_CRCON_TIMEOUT_SECONDS = 15.0
|
||||
DEFAULT_HISTORICAL_REFRESH_INTERVAL_SECONDS = 1800
|
||||
DEFAULT_HISTORICAL_REFRESH_MAX_RETRIES = 2
|
||||
DEFAULT_HISTORICAL_REFRESH_RETRY_DELAY_SECONDS = 30
|
||||
DEFAULT_ALLOWED_ORIGINS = (
|
||||
"null",
|
||||
"http://127.0.0.1:5500",
|
||||
@@ -95,6 +98,47 @@ def get_historical_crcon_request_timeout_seconds() -> float:
|
||||
return timeout_seconds
|
||||
|
||||
|
||||
def get_historical_refresh_interval_seconds() -> int:
|
||||
"""Return the default interval used by the historical refresh loop."""
|
||||
configured_value = os.getenv(
|
||||
"HLL_HISTORICAL_REFRESH_INTERVAL_SECONDS",
|
||||
str(DEFAULT_HISTORICAL_REFRESH_INTERVAL_SECONDS),
|
||||
)
|
||||
interval_seconds = int(configured_value)
|
||||
if interval_seconds <= 0:
|
||||
raise ValueError("HLL_HISTORICAL_REFRESH_INTERVAL_SECONDS must be positive.")
|
||||
|
||||
return interval_seconds
|
||||
|
||||
|
||||
def get_historical_refresh_max_retries() -> int:
|
||||
"""Return the retry count used by the historical refresh loop."""
|
||||
configured_value = os.getenv(
|
||||
"HLL_HISTORICAL_REFRESH_MAX_RETRIES",
|
||||
str(DEFAULT_HISTORICAL_REFRESH_MAX_RETRIES),
|
||||
)
|
||||
max_retries = int(configured_value)
|
||||
if max_retries < 0:
|
||||
raise ValueError("HLL_HISTORICAL_REFRESH_MAX_RETRIES must be zero or positive.")
|
||||
|
||||
return max_retries
|
||||
|
||||
|
||||
def get_historical_refresh_retry_delay_seconds() -> int:
|
||||
"""Return the wait time between historical refresh retries."""
|
||||
configured_value = os.getenv(
|
||||
"HLL_HISTORICAL_REFRESH_RETRY_DELAY_SECONDS",
|
||||
str(DEFAULT_HISTORICAL_REFRESH_RETRY_DELAY_SECONDS),
|
||||
)
|
||||
retry_delay_seconds = int(configured_value)
|
||||
if retry_delay_seconds < 0:
|
||||
raise ValueError(
|
||||
"HLL_HISTORICAL_REFRESH_RETRY_DELAY_SECONDS must be zero or positive."
|
||||
)
|
||||
|
||||
return retry_delay_seconds
|
||||
|
||||
|
||||
def get_a2s_targets_payload() -> str | None:
|
||||
"""Return the optional JSON payload that overrides local A2S targets."""
|
||||
raw_payload = os.getenv(DEFAULT_A2S_TARGETS_ENV_VAR)
|
||||
|
||||
Reference in New Issue
Block a user