-
Notifications
You must be signed in to change notification settings - Fork 31
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
Reduce UTFGrid Tile Caching #3087
Conversation
Because of CartoDB/Windshaft#310, UtfGrid tiles from the server can be incorrect due to internal caching. These incorrect results can be cached by the CDN and in browsers for up to 30 days, making it difficult to use the app. By appending a random querystring to the end of each tile request for UtfGrid values, we try and bust the cache and attempt to retrieve fresh values from the server every time, in the hopes that they will be correct.
Previously, if the user were to geocode search for something while a drawing tool was open, it would stay open when they landed in the new location. Now we close it, to force them to start drawing fresh for every location.
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.
As discussed in slack (https://azavea.slack.com/archives/C044CG212/p1550687631002300), this likely won't have the intended effect. Once the tile is initially rendered and placed on s3, query string parameters won't have an effect on subsequent requests. Since the problem lies within an internal cache of windshaft, the query string param would never get passed into the server and bust the cache.
Since our development environments bypass the s3 layer, this appears to work locally but would fail to fix the issue in staging/prod.
@@ -231,6 +231,8 @@ var DrawWindow = Marionette.LayoutView.extend({ | |||
model: this.model, | |||
resetDrawingState: resetDrawingState | |||
})); | |||
|
|||
this.listenTo(App.map, 'change:lat, change:lng', resetDrawingState); |
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.
This may be having a wider impact than intended, for other workflows. For example, if you geocode within the same city, the map moves only slightly, but the loaded boundary layer is removed. Was this meant to be targeted only at the free-hand draw tool?
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.
You're right, I think this is too wide-ranging. I think it makes sense to do this for both free-draw and boundary, especially if it helped with the UtfGrid caching issue, but since it doesn't I don't think we should keep it. I'm going to close this PR.
Overview
Attempts to help with incorrect UtfGrid results by appending a random string to tile requests to get fresh tiles every time. Unfortunately, because of CartoDB/Windshaft#310, the true underlying issue can only be fixed by upgrading Windshaft, which can be a pretty involved process (see OpenTreeMap/otm-tiler#116).
We also disable the drawing tool upon search, hoping to create a further delay that could help invalidate the internal cache.
Connects #3082
Notes
This is not a new bug, and has probably been there from the very beginning. A short term solution would be to invalidate all
.grid.json
caches in production when this is deployed.Testing Instructions
bundle