mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.36k stars 1.33k forks source link

[core] Introduce Source::setMinimumTileUpdateInterval API #16416

Closed pozdnyakov closed 4 years ago

pozdnyakov commented 4 years ago

The Source::setMinimumTileUpdateInterval(Duration) method sets the minimum tile update interval, which is used to throttle the tile update network requests.

The corresponding Source::getMinimumTileUpdateInterval() getter is added too.

Default minimum tile update interval value is Duration::zero().

Tag https://github.com/mapbox/mapbox-gl-native-team/issues/335

alexshalamov commented 4 years ago

/cc @asheemmamoowala do you think that property would be useful for gl-js as well?

asheemmamoowala commented 4 years ago

@asheemmamoowala do you think that property would be useful for gl-js as well?

@pozdnyakov Is there any documentation around what this method is supposed to do? Tracking for parity at https://github.com/mapbox/mapbox-gl-js/issues/9603, but I don't see any use case for it in GL-JS as yet.

pozdnyakov commented 4 years ago

@pozdnyakov Is there any documentation around what this method is supposed to do?

Just in this pr description, and the inline comments in source.hpp.. However, it's quite simple: it makes sure the update tile network request does not happen more often than the given duration (even if the server-provided expiration date supposes more frequent tile updates)

chloekraw commented 4 years ago

@pozdnyakov a few follow-up questions:


cc @mapbox/maps-android @knov to cut tickets for platform bindings. For now, it's only a high priority on Android.

cc @asheemmamoowala

pozdnyakov commented 4 years ago
  • can Source::setMinimumTileUpdateInterval(Duration) be safely called at any time?

yeah

  • once a TTL override is set, can the same API call be used to change the override? For example, if a device were on low power mode, you might want to slow down a source's refresh rate even further.

absolutely, the resulting network request interval is always = max(TTL, minimuTileUpdateInterval /* set by the introduced API*/)

chloekraw commented 4 years ago

thanks for the clarification @pozdnyakov!