• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In
You are now the owner of this repo.

rm-hull / next-departures-api / 25460597244

06 May 2026 08:54PM UTC coverage: 28.253% (+0.2%) from 28.031%
25460597244

Pull #14

github

rm-hull
feat: add Traveline fallback for SIRI rate limits

Implement a fallback mechanism to fetch bus departures from Traveline
when the primary SIRI API exceeds its usage limits. This ensures service
availability even after the daily TransportAPI quota is exhausted.

-   Introduces `FallbackManager` to track rate-limit state.
-   Adds `TravelineClient` to scrape live departures from the Traveline
    website.
-   Includes a daily **CRON** job to reset the fallback state at
    midnight.
-   Updates `NextDepartures` route to automatically switch providers.

```mermaid
sequenceDiagram
    participant User
    participant API as API Server
    participant SIRI as SIRI API
    participant FM as Fallback Manager
    participant TVL as Traveline

    User->>API: GET /v1/next-departures/:id
    API->>FM: IsSiriRateLimited?
    alt No
        API->>SIRI: Request departures
        alt Success
            SIRI-->>API: Departure data
        else Rate Limited (429/403)
            SIRI-->>API: Limit Exceeded
            API->>FM: SetSiriRateLimited(true)
            API->>TVL: Scrape departures
            TVL-->>API: Fallback data
        end
    else Yes
        API->>TVL: Scrape departures
        TVL-->>API: Fallback data
    end
    API-->>User: JSON Response
```
Pull Request #14: feat: add Traveline fallback for SIRI rate limits

50 of 143 new or added lines in 5 files covered. (34.97%)

317 of 1122 relevant lines covered (28.25%)

0.31 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/cmd/api_server.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc