perf: fetch split quadrants concurrently with bounded Overpass concurrency - #196
Open
anthony-at-pieces wants to merge 1 commit into
Open
Conversation
…rency Sequential quadrant fetching made worst-case splitting 64 sequential Overpass requests (max split depth 3). Fetch the 4 quadrants of each split round concurrently instead, bounding total concurrent Overpass requests (including nested splits) with a counting semaphore (cap 4). Per-quadrant failure isolation is preserved: a failed quadrant logs and contributes no nodes while the remaining quadrants complete. Adds a @VisibleForTesting constructor so NodeDataManager can be built with a faked Overpass client for concurrency tests. Closes FoggedLens#109
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Future.wait) instead of one-at-a-time — worst case drops from 64 sequential Overpass requests (max split depth 3) to ~3 rounds of parallel requestsservice_policy.dart("concurrency managed by NodeDataManager")@visibleForTestingconstructor soNodeDataManagercan be built with a faked Overpass client (no production behavior change)Test plan
flutter test test/services/node_data_manager_test.dart— 3 new tests:flutter analyze --no-fatal-infos— no issuesflutter test— full suite passes (270 tests)Expected: <5> ... Actual: <2>— 3 of 4 quadrant requests never started)Notes
RateLimitErrorstill backs off without splitting (splitting into 4x requests against a 429'ing server would be counterproductive), so the semaphore only ever governsNodeLimitError-driven splits._fetchSplitAreas+ the semaphore; intentionally does not fold in the broader smart-fetching work from Smart Overpass fetching, SQLite node cache, and rate-limit handling #133.Closes #109