Move to hour-resolution adverts

This commit is contained in:
Jack Kingsman
2026-02-23 16:34:34 -08:00
parent 88d5a76081
commit ef4c79bc80
6 changed files with 90 additions and 31 deletions
+8
View File
@@ -41,6 +41,11 @@ _advert_task: asyncio.Task | None = None
# We still need to periodically check if it's been enabled
ADVERT_CHECK_INTERVAL = 60
# Minimum allowed advertisement interval (1 hour).
# Even if the database has a shorter value, we silently refuse to advertise
# more frequently than this.
MIN_ADVERT_INTERVAL = 3600
# Counter to pause polling during repeater operations (supports nested pauses)
_polling_pause_count: int = 0
@@ -384,6 +389,9 @@ async def send_advertisement(force: bool = False) -> bool:
logger.debug("Advertisement skipped: periodic advertising is disabled")
return False
# Enforce minimum interval floor
interval = max(interval, MIN_ADVERT_INTERVAL)
# Check if enough time has passed
elapsed = now - last_time
if elapsed < interval: