Skip to content

Commit dedb3df

Browse files
committed
Fix #23065: Mapillary fails to download images for a sequence
This is primarily caused by flaky connections. We now retry 10 times (by default). Signed-off-by: Taylor Smock <[email protected]>
1 parent 3a38ab8 commit dedb3df

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/workers/MapillarySequenceDownloader.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.openstreetmap.josm.plugins.mapillary.data.mapillary.MapillarySequence;
2121
import org.openstreetmap.josm.plugins.mapillary.gui.layer.MapillaryLayer;
2222
import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryImageUtils;
23+
import org.openstreetmap.josm.spi.preferences.Config;
2324
import org.openstreetmap.josm.tools.JosmRuntimeException;
2425
import org.openstreetmap.josm.tools.Logging;
2526
import org.openstreetmap.josm.tools.Pair;
@@ -121,7 +122,13 @@ protected MapillarySequence doInBackground() {
121122
}
122123

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

0 commit comments

Comments
 (0)