From e73c2f6536fe4203a138424980226010eea5c5e6 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Tue, 5 May 2026 12:24:11 -1000 Subject: fix: raise conditions throttle to 20 min / 10 nm to stop 429s MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous gate (5 min AND 2 nm) meant any pan > 2 nm triggered a fresh fetch regardless of how recently one completed. Raised to 20 min OR 10 nm — marine conditions don't change meaningfully at finer resolution than that. Co-Authored-By: Claude Sonnet 4.6 --- android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt b/android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt index 530af39..502c44f 100644 --- a/android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt +++ b/android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt @@ -242,14 +242,14 @@ class MainViewModel( /** * Fetches current conditions snapshot for [lat]/[lon] and exposes it via [marineConditions]. - * Throttled: skips if conditions loaded < 5 min ago and position < 2 nm from last load. + * Throttled: skips unless the position moved >= 10 nm OR data is >= 20 min old. */ fun loadConditions(lat: Double, lon: Double) { val nowMs = System.currentTimeMillis() val ageMs = nowMs - lastConditionsMs val distNm = if (lastConditionsLat.isNaN()) Double.MAX_VALUE else distanceNm(lastConditionsLat, lastConditionsLon, lat, lon) - if (ageMs < 5 * 60_000L && distNm < 2.0) { + if (ageMs < 20 * 60_000L && distNm < 10.0) { NavLogger.i("conditions", "skip age=${ageMs / 1000}s dist=%.1fnm".format(distNm)) return } -- cgit v1.2.3