Skip to content

feat(cron): migrate from robfig/cron/v3 to hyp3rd/cron/v4#87

Merged
hyp3rd merged 1 commit intomainfrom
feat/admin-ui
Apr 10, 2026
Merged

feat(cron): migrate from robfig/cron/v3 to hyp3rd/cron/v4#87
hyp3rd merged 1 commit intomainfrom
feat/admin-ui

Conversation

@hyp3rd
Copy link
Copy Markdown
Owner

@hyp3rd hyp3rd commented Apr 10, 2026

Replace the github.com/robfig/cron/v3 dependency with the internal github.com/hyp3rd/cron/v4 fork across all cron-related files.

Key changes:

  • Switch all cron entry scheduling to scheduleCronEntry, which wraps the new ScheduleNamed API to associate a name with each entry, enabling direct name resolution in AdminSchedules without requiring a reverse-lookup map fallback.
  • Update cronJob signature from func() to func(context.Context) error to align with the new FuncJob interface, and propagate the job's context through to runDurableCron and runInMemoryCron.
  • Update skipCronTick to also check the job-provided context in addition to the TaskManager's own context.
  • Replace cron.NewParser with cron.NewSpecParser throughout.
  • Pass context to cron.Start and handle the error returned by cron.Stop, ignoring expected cancellation errors.
  • Update go.mod and go.sum accordingly.

Replace the `github.com/robfig/cron/v3` dependency with the internal
`github.com/hyp3rd/cron/v4` fork across all cron-related files.

Key changes:
- Switch all cron entry scheduling to `scheduleCronEntry`, which wraps
  the new `ScheduleNamed` API to associate a name with each entry,
  enabling direct name resolution in `AdminSchedules` without requiring
  a reverse-lookup map fallback.
- Update `cronJob` signature from `func()` to `func(context.Context) error`
  to align with the new `FuncJob` interface, and propagate the job's
  context through to `runDurableCron` and `runInMemoryCron`.
- Update `skipCronTick` to also check the job-provided context in
  addition to the TaskManager's own context.
- Replace `cron.NewParser` with `cron.NewSpecParser` throughout.
- Pass context to `cron.Start` and handle the error returned by
  `cron.Stop`, ignoring expected cancellation errors.
- Update `go.mod` and `go.sum` accordingly.
Copilot AI review requested due to automatic review settings April 10, 2026 17:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the worker scheduler from github.com/robfig/cron/v3 to the internal fork github.com/hyp3rd/cron/v4, updating scheduling and lifecycle handling to match the new API and improving schedule name resolution in admin views.

Changes:

  • Replace Schedule with ScheduleNamed via a scheduleCronEntry helper and use entry.Name in AdminSchedules (with map fallback).
  • Update cron job execution to accept a context.Context (and propagate it into task factories / registrations); extend skipCronTick to consider the job context.
  • Switch parsers to NewSpecParser, pass context into cron.Start, and handle errors from cron.Stop; update go.mod/go.sum and imports accordingly.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
worker.go Swap cron dependency import to github.com/hyp3rd/cron/v4.
cron.go Core migration: ScheduleNamed wrapper, context-aware cron jobs, parser + Start/Stop API updates.
admin_taskmanager.go Prefer entry.Name for schedule listing; use scheduleCronEntry when creating schedules.
go.mod Replace robfig/cron/v3 with hyp3rd/cron/v4.
go.sum Add checksums for hyp3rd/cron/v4 and remove robfig/cron/v3.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hyp3rd hyp3rd self-assigned this Apr 10, 2026
@github-advanced-security
Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@hyp3rd hyp3rd merged commit cdfbf1b into main Apr 10, 2026
42 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants