This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[all] Don't interpret 404s on non-tile resources as "no content"
- Loading branch information
1 parent
7eb1a91
commit e9302c7
Showing
16 changed files
with
256 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,8 +101,8 @@ optional<Response> OfflineDatabase::get(const Resource& resource) { | |
} | ||
|
||
void OfflineDatabase::put(const Resource& resource, const Response& response) { | ||
// Except for 404s, don't store errors in the cache. | ||
if (response.error && response.error->reason != Response::Error::Reason::NotFound) { | ||
// Don't store errors in the cache. | ||
if (response.error) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jfirebaugh
Author
Contributor
|
||
return; | ||
} | ||
|
||
|
@@ -135,7 +135,7 @@ optional<Response> OfflineDatabase::getResource(const Resource& resource) { | |
|
||
optional<std::string> data = stmt.get<optional<std::string>>(3); | ||
if (!data) { | ||
response.error = std::make_unique<Response::Error>(Response::Error::Reason::NotFound); | ||
response.noContent = true; | ||
} else if (stmt.get<int>(4)) { | ||
response.data = std::make_shared<std::string>(util::decompress(*data)); | ||
} else { | ||
|
@@ -170,7 +170,7 @@ void OfflineDatabase::putResource(const Resource& resource, const Response& resp | |
|
||
std::string data; | ||
|
||
if (response.error) { // Can only be NotFound | ||
if (response.noContent) { | ||
stmt.bind(7 /* data */, nullptr); | ||
stmt.bind(8 /* compressed */, false); | ||
} else { | ||
|
@@ -218,7 +218,7 @@ optional<Response> OfflineDatabase::getTile(const Resource::TileData& tile) { | |
|
||
optional<std::string> data = stmt.get<optional<std::string>>(3); | ||
if (!data) { | ||
response.error = std::make_unique<Response::Error>(Response::Error::Reason::NotFound); | ||
response.noContent = true; | ||
} else if (stmt.get<int>(4)) { | ||
response.data = std::make_shared<std::string>(util::decompress(*data)); | ||
} else { | ||
|
@@ -276,7 +276,7 @@ void OfflineDatabase::putTile(const Resource::TileData& tile, const Response& re | |
|
||
std::string data; | ||
|
||
if (response.error) { // Can only be NotFound | ||
if (response.noContent) { | ||
stmt2.bind(10 /* data */, nullptr); | ||
stmt2.bind(11 /* compressed */, false); | ||
} else { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
This means we're no longer storing 404 responses in the cache. What is the motivation behind doing that?