wri / gfw_forest_loss_geotrellis

Global Tree Cover Loss Analysis using Geotrellis and SPARK
MIT License
10 stars 8 forks source link

GTC-2823 Fix retries when getting latest version of a dataset #231

Closed danscales closed 5 months ago

danscales commented 5 months ago

GTC-2823 Fix retries when getting latest version of a dataset

I noticed that the retry code in RasterCatalog.getLatestVersion was not correct. It was using recursion to do one or more retries, but wasn't actually using any successful response from a retry, but instead still used the original unsuccessful response. Broke out a separate function getLatestVersionResponse() to fix the problem. I am still doing 2 more retries after the first request.

Also, increased the connection timeout from 10 seconds to 20 seconds.

These fixes should make Geotrellis more resilient to slow responses from the Data API. With a bigger change, I could also get rid of the "latest version" requests for FCD and AFI analyses, since they don't actually use the integrated alerts dataset.

danscales commented 5 months ago

Thanks for the review!