17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-20 15:04:54 +02:00

fix(editor): a blank standard orthophoto tile that the geoportal sent while it was busy is removed from the disk cache and fetched once more, instead of staying a black hole in the map for good

This commit is contained in:
maj00r
2026-10-15 17:00:44 +02:00
parent fc3f391e19
commit d0ebb01c2f

View File

@@ -463,7 +463,17 @@ bool is_blank(image const &Image)
bool load_standard(http_client &Client, tile_request const &Request, image &Out, std::string &Error, stop_check const &Stop)
{
std::vector<std::uint8_t> data;
return fetch(Client, wms_url(Request, false, standard_pixels, false), cache_file(Request, false, std::to_string(standard_pixels) + ".jpg"), data, Error, Stop) && decode(data, Out, Error);
auto const path{cache_file(Request, false, std::to_string(standard_pixels) + ".jpg")};
for (int attempt = 0; attempt < 2; ++attempt)
{
if (!fetch(Client, wms_url(Request, false, standard_pixels, false), path, data, Error, Stop) || !decode(data, Out, Error))
return false;
if (!is_blank(Out))
return true;
std::error_code ec;
fs::remove(path, ec);
}
return true;
}
// returns false on failure (to be retried later); Empty is set when the place has no imagery