Skip to content

feat: Support SQLite GTFS Hot-Swap on Daily Static Updates #157

@Ahmedhossamdev

Description

@Ahmedhossamdev

The daily GTFS update flow refreshes in-memory static data only.
The persistent SQLite database (gtfs.db) is not rebuilt, causing SQL-backed endpoints to serve stale data.

TODOs

  • Build New SQLite Database
    After downloading the new GTFS feed in updateStaticGTFS, build a fresh SQLite database to a temporary file (e.g. gtfs_next.db) with all tables and indexes.

  • Initialize New GtfsDB Client
    Open a new GtfsDB client using the newly built database and verify it is readable before activation.

  • Hot-Swap Active GtfsDB
    Atomically replace the active GtfsDB client in Manager so new requests use the updated database without downtime.

  • Sync In-Memory Static Data
    Reload or realign in-memory static data structures to ensure consistency with the newly swapped SQLite database.

  • Clean Up Old Database
    Gracefully close the old database connection and remove the previous SQLite file after the swap succeeds.

Acceptance Criteria

  • SQLite-backed endpoints serve fresh GTFS data after the daily update
  • No downtime or inconsistent reads during the database swap
  • In-memory and persistent GTFS data remain in sync

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions