summaryrefslogtreecommitdiff
path: root/android-app
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-05-05 12:24:11 -1000
committerPeter Stone <thepeterstone@gmail.com>2026-05-05 12:24:11 -1000
commite73c2f6536fe4203a138424980226010eea5c5e6 (patch)
treefa25edeab46a789308b1552a069fa5583c65f4c6 /android-app
parent228b942221d1ad8f46a5359e90c253f73fddcf66 (diff)
fix: raise conditions throttle to 20 min / 10 nm to stop 429s
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 <noreply@anthropic.com>
Diffstat (limited to 'android-app')
-rw-r--r--android-app/app/src/main/kotlin/org/terst/nav/ui/MainViewModel.kt4
1 files 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
}