flight-cli: make the calendar GF+Matrix weave concurrent (work-6nrqf)#32
Open
ak2k wants to merge 1 commit into
Open
flight-cli: make the calendar GF+Matrix weave concurrent (work-6nrqf)#32ak2k wants to merge 1 commit into
ak2k wants to merge 1 commit into
Conversation
_run_calendar_enriched dispatches the Google Flights date-grid and the Matrix calendar under one anyio.run (mirroring _run_enriched_path): start_soon Matrix, run the sync GF grid in a worker thread concurrently, paint the grid first while Matrix is in flight, then paint the authoritative Matrix calendar. Total wall ~= max(GF, Matrix) ~= Matrix alone, instead of GF+Matrix sequential. Per-backend error isolation (GF throttle/failure -> Matrix still paints; Matrix error -> grid still shown). --fast unchanged (GF grid only). The grid_can_serve gate guarantees a single-airport query, so Matrix is one execute (no fan-out). 3 new orchestration tests (happy + GF-throttle + Matrix-error isolation); make check green (504); live-smoked.
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
Makes the one-way / single-airport calendar weave concurrent (
work-6nrqf).Previously the calendar ran the Google Flights date-grid (~1s, up to ~9s cold) and painted it, then ran the Matrix calendar (~45s) — sequential, so the GF time stacked on top of Matrix.
New
_run_calendar_enricheddispatches both under oneanyio.run, mirroring the search path's_run_enriched_path:start_soonthe Matrix calendar, run the sync GF date-grid in a worker thread concurrently, paint the grid first while Matrix is in flight, then paint the authoritative Matrix calendar. Total wall ≈ max(GF, Matrix) ≈ Matrix alone.Behavior
GfThrottledError) or failure still runs + paints Matrix; a Matrix error still shows the GF grid, and exits non-zero only when neither backend produced anything.--fastunchanged — GF date-grid only, no Matrix (the original block, preserved verbatim, just gated onfast).grid_can_serve, which guarantees a single-airport query, so the Matrix side is a singleexecute(no fan-out, no merge — the GF grid and Matrix calendar are separate paints).Tests
3 new orchestration tests in
test_calendar_split.py(happy path + GF-throttle isolation + Matrix-error isolation), fakes for both backends, no network.make checkgreen (504 tests).--fastverified unchanged.