diff --git a/lib/services/map_data_submodules/cameras_from_overpass.dart b/lib/services/map_data_submodules/cameras_from_overpass.dart index d283398..489ef2c 100644 --- a/lib/services/map_data_submodules/cameras_from_overpass.dart +++ b/lib/services/map_data_submodules/cameras_from_overpass.dart @@ -30,12 +30,13 @@ Future> camerasFromOverpass({ // Helper for one Overpass chunk fetch Future> fetchChunk() async { + final outLine = fetchAllPages ? 'out body;' : 'out body $pageSize;'; final query = ''' [out:json][timeout:25]; ( $nodeClauses ); - out body $pageSize; + $outLine '''; try { print('[camerasFromOverpass] Querying Overpass...'); @@ -62,37 +63,6 @@ Future> camerasFromOverpass({ } } - if (!fetchAllPages) { - // Just one page - return await fetchChunk(); - } else { - // Fetch all possible data, paging with deduplication and backoff - final seenIds = {}; - final allCameras = []; - int page = 0; - while (true) { - page++; - List pageCameras = []; - int tries = 0; - while (tries < maxTries) { - try { - final cams = await fetchChunk(); - pageCameras = cams.where((c) => !seenIds.contains(c.id)).toList(); - break; - } catch (e) { - tries++; - final delayMs = 400 * (1 << tries); - print('[camerasFromOverpass][paged] Error on page $page try $tries: $e. Retrying in ${delayMs}ms.'); - await Future.delayed(Duration(milliseconds: delayMs)); - } - } - if (pageCameras.isEmpty) break; - print('[camerasFromOverpass][paged] Page $page: got ${pageCameras.length} new cameras.'); - allCameras.addAll(pageCameras); - seenIds.addAll(pageCameras.map((c) => c.id)); - if (pageCameras.length < pageSize) break; - } - print('[camerasFromOverpass][paged] DONE. Found ${allCameras.length} cameras for download.'); - return allCameras; - } + // All paths just use a single fetch now; paging logic no longer required. + return await fetchChunk(); }