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

Commit

Permalink
Fix #23065: Mapillary fails to download images for a sequence
Browse files Browse the repository at this point in the history
This is primarily caused by flaky connections. We now retry 10 times (by default).

Signed-off-by: Taylor Smock <[email protected]>
  • Loading branch information
tsmock committed Jul 18, 2023
1 parent 3a38ab8 commit dedb3df
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.openstreetmap.josm.plugins.mapillary.data.mapillary.MapillarySequence;
import org.openstreetmap.josm.plugins.mapillary.gui.layer.MapillaryLayer;
import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryImageUtils;
import org.openstreetmap.josm.spi.preferences.Config;
import org.openstreetmap.josm.tools.JosmRuntimeException;
import org.openstreetmap.josm.tools.Logging;
import org.openstreetmap.josm.tools.Pair;
Expand Down Expand Up @@ -121,7 +122,13 @@ protected MapillarySequence doInBackground() {
}

private void getImageRange(int i, long[] imagesToGet, long[] images) {
int retries = 0;
Map<String, List<MapillaryNode>> map = MapillaryDownloader.downloadImages(imagesToGet);
while (retries < Config.getPref().getInt("mapillary.image.retries", 10) && (map.size() != 1
|| !map.containsKey(this.sequenceKey) || map.get(this.sequenceKey).size() != imagesToGet.length)) {
map = MapillaryDownloader.downloadImages(imagesToGet);
retries++;
}
if (map.size() != 1 || !map.containsKey(this.sequenceKey)) {
throw new IllegalArgumentException(
"Mapillary sequence " + this.sequenceKey + " did not download any images");
Expand Down

0 comments on commit dedb3df

Please sign in to comment.