Open Bug 2060573 Opened 3 months ago Updated 3 months ago

Back off the network geolocation repeating timer while the request cache keeps answering it

Categories

(Toolkit :: Geolocation Provider, task)

task

Tracking

()

People

(Reporter: jstutte, Unassigned)

References

(Blocks 1 open bug)

Details

Currently NetworkGeolocationProvider arms a 5s TYPE_REPEATING_SLACK timer for as long as any watchPosition is live. Since bug 2048118 nearly every one of those firings is a cache hit - but it is still a timer wakeup plus a cache comparison, forever.

Proposed fix: back the repeating interval off while the cache keeps answering it (double per cache-served firing, capped by a new geo.provider.network.cachedBackoffMaxMs, default 10 min) rather than stopping the timer. Chromium keeps a polling driver at all times - there is even a no-wifi-hardware interval - so a live watch is never left with nothing to refresh it, and stopping ours would couple this to link-change invalidation, which would then have to re-arm the timer.

Chromium's GenericWifiPollingPolicy sets some reasonable reference points: 10s default, 2 min after one unchanged scan, 10 min after two, 20s with no wifi hardware - and it has no fixed timer re-delivering positions at all.

Note: do not add a time-based cache lifespan before this lands. At a 5s cadence a blanket expiry forces 86,400/T misses per client-day, and a 5-minute expiry would give back more than the entire saving from bug 2048118. Once the cadence is backed off an age cap becomes close to free and is worth adding (Chromium's stated motive for its kMaximumLifetime is privacy, bounding location-history reconstruction, rather than staleness alone).

This will need the network change thing first that could fire extra signal asap, as this alone would slow down the geo update a lot.

Depends on: 2060572
Severity: -- → N/A
You need to log in before you can comment on or make changes to this bug.