Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Only cache successful or NotFound responses #3479

Merged
merged 1 commit into from
Jan 8, 2016

Conversation

kkaefer
Copy link
Member

@kkaefer kkaefer commented Jan 8, 2016

Right now, we're storing all sorts of responses into the cache, potentially overwriting existing successful responses. This means that a bad connection could slowly remove all cache items by simply requesting them.

We don't want other types of error end up in our cache, since it'll likely evict perfectly good content.
@kkaefer kkaefer self-assigned this Jan 8, 2016
@kkaefer kkaefer merged commit a06f28d into master Jan 8, 2016
@kkaefer kkaefer deleted the 3479-only-cache-successful branch January 8, 2016 16:18
@friedbunny
Copy link
Contributor

Nice! This fixes #2012, where 401s for bad access tokens were being cached.

Mapbox GL[DEBUG] {OnlineFileSource}[Setup]: response error: 6; https://api.mapbox.com/styles/v1/mapbox/streets-v8/sprite@2x.json?access_token=flaskjdflasdkjfalskdfjasd
Mapbox GL[DEBUG] {OnlineFileSource}[Setup]: NOT caching resource
Mapbox GL[ERROR] {Map}[Style]: Failed to load sprite: HTTP status code 401

@@ -50,3 +50,175 @@ TEST_F(Storage, CacheResponse) {

loop.run();
}

// Make sure we don't store a bad server response into the cache
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment should be "Make sure we do store 404 responses in the cache".

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in 13fbf8b

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

Successfully merging this pull request may close these issues.

3 participants