Changeset 17635 in josm for trunk/src/org


Ignore:
Timestamp:
2021-03-22T10:19:02+01:00 (4 years ago)
Author:
GerdP
Message:

fix #20633: Download object: Too slow when downloading a relation with members with OSM api

  • reduce work for DatasetMerger: avoid to add incomplete relation to downloaded dataset when full relation will be downloaded later. Saves lots of complex reindexRelation calls, esp. with complex relations.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r17333 r17635  
    443443     */
    444444    private void downloadRelations(ProgressMonitor progressMonitor) throws OsmTransferException {
     445        boolean removeIncomplete = outputDataSet.isEmpty();
    445446        Set<Long> toDownload = new LinkedHashSet<>(relations);
    446447        fetchPrimitives(toDownload, OsmPrimitiveType.RELATION, progressMonitor);
     
    450451        // OSM multi-fetch api may return invisible objects, we don't try to get details for them
    451452        for (Relation r : outputDataSet.getRelations()) {
    452             if (!r.isVisible())
     453            if (!r.isVisible()) {
    453454                toDownload.remove(r.getUniqueId());
    454         }
     455            } else if (removeIncomplete) {
     456                outputDataSet.removePrimitive(r);
     457            }
     458        }
     459
    455460        // fetch full info for all visible relations
    456461        for (long id : toDownload) {
Note: See TracChangeset for help on using the changeset viewer.