refactor: migrate GetAgencies() from in-memory to database query#832
Merged
Ahmedhossamdev merged 3 commits intomainfrom Apr 10, 2026
Merged
refactor: migrate GetAgencies() from in-memory to database query#832Ahmedhossamdev merged 3 commits intomainfrom
Ahmedhossamdev merged 3 commits intomainfrom
Conversation
…access from db queries instead of memory - Updated tests across multiple files to replace direct access of agency ID using `Id` with `ID` for consistency. - Introduced `mustGetAgencies` helper function to retrieve agencies in tests, ensuring that agency data is always available. - Adjusted assertions and endpoint calls to reflect the new agency ID field naming convention.
Performance Smoke Test ResultsStatus: PASSED
Smoke test config: 5 VUs x 30s. Thresholds: p(95) < 300ms, error rate < 1%. Full results uploaded as workflow artifact: k6-smoke-summary. |
fletcherw
approved these changes
Apr 9, 2026
Collaborator
fletcherw
left a comment
There was a problem hiding this comment.
there's some small feedback, feel free to merge yourself after fixing, or just merge as is.
| if len(stopIDs) == 0 { | ||
| // Return empty response if no stops found | ||
| agencies := utils.FilterAgencies(api.GtfsManager.GetAgencies(), agencyIDs) | ||
| agencies := utils.FilterAgencies(allAgencies, agencyIDs) |
Collaborator
There was a problem hiding this comment.
this queries all agencies then filters later by IDs, we should just query by ID with a batch query in a followup.
Performance Smoke Test ResultsStatus: PASSED
Smoke test config: 5 VUs x 30s. Thresholds: p(95) < 300ms, error rate < 1%. Full results uploaded as workflow artifact: k6-smoke-summary. |
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.
Fixes: #821
Part of: #820
Summary
manager.gtfsData.Agencies(in-memory slice) withmanager.GtfsDB.Queries.ListAgencies(ctx)inGetAgencies()mustGetAgenciestest helper that wrapsListAgencieswithrequire.NoErrorfor cleaner test setupNotes
GetAgencies()now returns[]gtfsdb.Agencyinstead of[]gtfs.Agency, so field access changes from.Id/.Languageto.ID/.Lang.Stringetc.