Skip to content

Commit 5ee10ff

Browse files
committed
Attempt to improve output in poor network conditions
This is done by using whatever has been downloaded, even if it doesn't have everything Signed-off-by: Taylor Smock <[email protected]>
1 parent 3b464bd commit 5ee10ff

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,11 @@ protected MapillarySequence doInBackground() {
118118

119119
private void getImageRange(int i, long[] imagesToGet, long[] images) {
120120
int retries = 0;
121-
Map<String, List<MapillaryNode>> map = MapillaryDownloader.downloadImages(imagesToGet);
121+
final Map<String, List<MapillaryNode>> map = MapillaryDownloader.downloadImages(imagesToGet);
122122
while (retries < Config.getPref().getInt("mapillary.image.retries", 10) && (map.size() != 1
123123
|| !map.containsKey(this.sequenceKey) || map.get(this.sequenceKey).size() != imagesToGet.length)) {
124-
map = MapillaryDownloader.downloadImages(imagesToGet);
124+
MapillaryDownloader.downloadImages(imagesToGet).forEach(
125+
(key, value) -> map.merge(key, value, (list1, list2) -> list1.size() > list2.size() ? list1 : list2));
125126
retries++;
126127
}
127128
if (map.size() != 1 || !map.containsKey(this.sequenceKey)) {

0 commit comments

Comments
 (0)