-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] Introduce Source::setMinimumTileUpdateInterval API #16416
Conversation
fc67f52
to
ad7313d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
/cc @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 mapbox/mapbox-gl-js#9603, but I don't see any use case for it in GL-JS as yet. |
Introduce `Resource::minimumUpdateInterval` and consider it in the online file source. The `minimumUpdateInterval` is used to throttle the requests, which were initiated due to resource expiration.
The `Source::setMinimumTileUpdateInterval()` method sets the minimum tile update interval, which is used to throttle the tile update network requests. Default value is `Duration::zero()`.
ad7313d
to
0c4cbaa
Compare
Just in this pr description, and the inline comments in |
std::unique_ptr<AsyncRequest> req = fs->request(resource, [&](Response) { | ||
auto wait = util::now() - start; | ||
EXPECT_GE(wait, resource.minimumUpdateInterval); | ||
EXPECT_LT(wait, resource.minimumUpdateInterval + Milliseconds(10)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1: [ RUN ] OnlineFileSource.RespectMinimumUpdateInterval
1: ../test/storage/online_file_source.test.cpp:232: Failure
1: Expected: (wait) < (resource.minimumUpdateInterval + Milliseconds(10)), actual: 8-byte object <02-00 00-00 00-00 00-00> vs 8-byte object <80-60 33-3C 00-00 00-00>
This one here is flaking.
@@ -76,6 +79,14 @@ class Source : public mbgl::util::noncopyable { | |||
void setPrefetchZoomDelta(optional<uint8_t> delta) noexcept; | |||
optional<uint8_t> getPrefetchZoomDelta() const noexcept; | |||
|
|||
// If the given source supports loading tiles from a server, | |||
// sets the minimum tile update interval, which is used to | |||
// throttle the tile update network requests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "suppress" might be a better word here, if we're preventing the update network requests from happening entirely. "throttle" sounds like the request is still made but we're slowing them down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our requests are still made but less frequently, is "suppress" still a better word?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, so my thinking is, update network requests that are more frequent than the minimumTileUpdateInterval
are suppressed (i.e., not made at all) -- is that accurate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, we can put it that way, I'll update this comment in #16422
@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. |
yeah
absolutely, the resulting network request interval is always |
thanks for the clarification @pozdnyakov! |
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