Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow sharing queues between tile layers. #1100

Merged
merged 3 commits into from
Jul 16, 2021
Merged

Conversation

manthey
Copy link
Contributor

@manthey manthey commented Jul 8, 2021

Although you could sort of share the fetch queue between tile layers, it wouldn't really share properly without a custom needed function. This explicitly supports sharing a fetch queue between tile layers.

This allows, for instance, multiple layers that access the same server to have a single fetch queue so that the number of requests against the server is limited (usually to 6) rather than that number multiplied by the number of layers.

This also adds an additional reference parameter to tile labels which prevents there from being a tile string collision between layers.

The multiframe tutorial now uses this.

@manthey
Copy link
Contributor Author

manthey commented Jul 8, 2021

@aashish24 This is intended to be the first of a few improvements that will allow better buffering of multiple tile sources. Follow on work will include an explicit A/B buffered tile layer.

manthey added 2 commits July 9, 2021 15:08
Although you could sort of share the fetch queue between tile layers, it
wouldn't really share properly without a custom needed function.  This
explicitly supports sharing a fetch queue between tile layers.

This allows, for instance, multiple layers that access the same server
to have a single fetch queue so that the number of requests against the
server is limited (usually to 6) rather than that number multiplied by
the number of layers.
@manthey manthey requested a review from aashish24 July 12, 2021 15:21
Base automatically changed from multiframe-tutorial to master July 16, 2021 15:45
get: function () { return m_this._queue; },
set: function (queue) {
if (m_this._queue !== queue) {
if (this._queue && this._queue._tileLayers && this._queue._tileLayers.indexOf(m_this) >= 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some idea why this is necessary but wondering if you could provide some explanations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a needed function that determines if a tile is still needed. A tile is needed if it is needed by at least one layer that is using it. The _tileLayers array is just a way to make sure we can enumerate the layers that are sharing the queue, and walk through the layers and ask if any layer needs a tile. Setting the queue (or exiting the layer) needs to maintain the book keeping for this list of layers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add that as a comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that makes sense. So in the next line why are we setting this index to 1? The tileLayer is already has this queue before but the index may have been zero or above zero. Just wondering.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not. We are removing the layer from the old queue's _tileLayers list it was part of. The splice(index, 1) says remove 1 value at its current location. We then push in on the new queue's _tileLayers list at the end of the function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks for reminding the function execution, okay that makes sense.

@manthey manthey merged commit 24be7fc into master Jul 16, 2021
@manthey manthey deleted the share-queues branch July 16, 2021 16:22
@github-actions
Copy link

🎉 This PR is included in version 1.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants