• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rm-hull / metoffice-uk-weather-overlays / 20471331165
9%

Build:
DEFAULT BRANCH: main
Ran 23 Dec 2025 08:52PM UTC
Jobs 1
Files 13
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

23 Dec 2025 08:52PM UTC coverage: 9.252% (-0.7%) from 10.0%
20471331165

push

github

web-flow
feat: add background cron job for data downloads (#42)

* feat: add background cron job for data downloads

Automate weather data retrieval by integrating a background cron job
within the API server. This ensures that the local data cache is
periodically updated without manual intervention.

To support this, the downloader logic has been refactored from the `cmd`
package into the `internal` package to allow shared access between the
CLI download command and the background task. Additionally, the API
server now validates required environment variables on startup and
propagates errors back to the root command.

*   Added `github.com/robfig/cron/v3` dependency.
*   Moved `Processor` and image pipeline logic to
`internal/downloader.go`.
*   Implemented `StartCron` in `internal/cron.go` with a pre-defined
    schedule.
*   Updated `ApiServer` to initialize the cron scheduler before starting
    the HTTP listener.

```mermaid
sequenceDiagram
    participant CLI as Main / CLI
    participant API as ApiServer
    participant Cron as Cron Scheduler
    participant DL as Downloader

    CLI->>API: ApiServer(root, port, debug)
    API->>API: Validate Environment Variables
    API->>Cron: StartCron(root, apiKey, orderId)
    activate Cron
    Cron-->>API: Return Cron Instance
    deactivate Cron
    API->>API: Start Gin Server (HTTP)

    Note over Cron: At 04:30, 05:30, 06:30
    Cron->>DL: NewDownloader(...)
    Cron->>DL: StartWorkers()
    Cron->>DL: DispatchJobs()
    Cron->>DL: Wait()
    DL-->>Cron: Log Results/Errors
```

* Update internal/cron.go

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

0 of 202 new or added lines in 5 files covered. (0.0%)

1 existing line in 1 file now uncovered.

47 of 508 relevant lines covered (9.25%)

0.1 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
2
0.0
0.0% main.go
3
0.0
0.0% cmd/download.go
17
0.0
0.0% cmd/api_server.go
24
0.0
internal/cron.go
156
0.0
internal/downloader.go

Uncovered Existing Lines

Lines Coverage ∆ File
1
0.0
0.0% main.go
Jobs
ID Job ID Ran Files Coverage
1 20471331165.1 23 Dec 2025 08:52PM UTC 13
9.25
GitHub Action Run
Source Files on build 20471331165
  • Tree
  • List 13
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • dd6588b6 on github
  • Prev Build on main (#20470650577)
  • Next Build on main (#20584244304)
  • Delete
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