Skip to content

Abort Ongoing Tile Requests When New Tileset is Created - #5342

Merged
Pessimistress merged 10 commits into
visgl:masterfrom
ilan-gold:abort_tile_requests_on_update
Jan 19, 2021
Merged

Pessimistress merged 10 commits into
visgl:masterfrom
ilan-gold:abort_tile_requests_on_update

Conversation

@ilan-gold

Copy link
Copy Markdown
Collaborator

For #5297. Adds a finalize function to the Tileset2D to handle aborting the ongoing tile requests when a new Tileset2D is about to be made by the layer.

I could add a test with setTimeout or something to guarantee tiles can actually be aborted but not sure that it's really a "unit test" at that point. Also, I don't think I need to do anything to the visibility of the tiles since the previous (i.e the one having finalize called) Tileset2D's tiles are all abandoned by the next render anyway (might have that wrong).

Background

Rapid changes on updateTriggers to the TileLayer can leave tile requests hanging, slowing down the application. This PR adds the ability to abort ongoing requests when updateTriggers are triggered.

Change List

  • Add a finalize function to Tileset2D for aborting ongoing tile requests.
  • Changed the state variable from tiles to tileset in initializeState because tiles was removed some time ago. I can remove this though, just noticed it.

@coveralls

coveralls commented Jan 16, 2021 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.03%) to 82.09% when pulling 3f468fd on ilan-gold:abort_tile_requests_on_update into b99adc3 on visgl:master.

@chrisgervang

Copy link
Copy Markdown
Collaborator

Hey! This looks good. I pulled it down yesterday and started to think about how we might add a test to cover it. I was thinking we could load a couple tiles, some loaded, some pending, then finalize and check the cache to look as expected.

Do you have an ideas for how you'd test it?

@ilan-gold

ilan-gold commented Jan 17, 2021 •

Copy link
Copy Markdown
Collaborator Author

I tried adding a test using sleep @chrisgervang and pushed the branch. Let me know how that looks. I wasn't sure how else to control exactly which tiles get loaded when and it (the sleep function) seemed to be used in the tests already.

@ilan-gold

Copy link
Copy Markdown
Collaborator Author

@chrisgervang I just realized we probably want to test the layer as well. I will add that as well.

@chrisgervang

Copy link
Copy Markdown
Collaborator

Sounds good. I've written a second test for tileset-2d to cover a partial load, and a reload. Check it out here ilan-gold/deck.gl@abort_tile_requests_on_update...visgl:chr/abort_tile_requests_on_update

@ilan-gold

Copy link
Copy Markdown
Collaborator Author

@chrisgervang I'm realizing that because the old Tileset2D is discarded, there may not be any way to test this on the layer i.e we can't access the old layer.state.tileset to check if tiles have been aborted.

@Pessimistress

Copy link
Copy Markdown
Collaborator

@ilan-gold You can query the tileset right after the initial update and hold on to the tile instances.

@ilan-gold

Copy link
Copy Markdown
Collaborator Author

@Pessimistress just saw this but had the same thought. Will do.

@Pessimistress
Pessimistress merged commit 19af42d into visgl:master Jan 19, 2021
@ilan-gold ilan-gold mentioned this pull request Jan 22, 2021
2 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants