Refine built-in web app experience
This commit is contained in:
@@ -60,9 +60,7 @@ class DiscoveryService:
|
||||
|
||||
def _background_interval_seconds(self) -> int:
|
||||
return int(
|
||||
os.getenv(
|
||||
"DISCOVERY_INTERVAL_SECONDS", DEFAULT_DISCOVERY_INTERVAL_SECONDS
|
||||
)
|
||||
os.getenv("DISCOVERY_INTERVAL_SECONDS", DEFAULT_DISCOVERY_INTERVAL_SECONDS)
|
||||
)
|
||||
|
||||
def _background_missing_threshold(self) -> int:
|
||||
@@ -161,7 +159,9 @@ class DiscoveryService:
|
||||
if not candidates:
|
||||
return []
|
||||
|
||||
private_candidates = [candidate for candidate in candidates if candidate.address.is_private]
|
||||
private_candidates = [
|
||||
candidate for candidate in candidates if candidate.address.is_private
|
||||
]
|
||||
usable_candidates = private_candidates or candidates
|
||||
preferred_candidates = [
|
||||
candidate
|
||||
@@ -202,9 +202,7 @@ class DiscoveryService:
|
||||
f"{local_ip}/{self._auto_min_prefix_len()}",
|
||||
strict=False,
|
||||
)
|
||||
logger.info(
|
||||
"Авто-discovery fallback: использую локальный сегмент %s", network
|
||||
)
|
||||
logger.info("Авто-discovery fallback: использую локальный сегмент %s", network)
|
||||
return [str(network)]
|
||||
|
||||
def _get_target_subnets(self) -> List[str]:
|
||||
@@ -298,6 +296,7 @@ class DiscoveryService:
|
||||
remove_missing=remove_missing,
|
||||
missing_threshold=missing_threshold,
|
||||
)
|
||||
state_manager.record_discovery(mode, result)
|
||||
logger.info(
|
||||
"Discovery (%s): found=%s added=%s updated=%s removed=%s pending_removal=%s online=%s",
|
||||
mode,
|
||||
@@ -337,7 +336,9 @@ class DiscoveryService:
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
async def start_background_discovery(self, state_manager, interval: int | None = None):
|
||||
async def start_background_discovery(
|
||||
self, state_manager, interval: int | None = None
|
||||
):
|
||||
interval_seconds = interval or self._background_interval_seconds()
|
||||
while True:
|
||||
await asyncio.sleep(interval_seconds)
|
||||
|
||||
Reference in New Issue
Block a user