Skip to content

Evaluate replacing robfig/cron due to unmaintained status #263

@CybotTM

Description

@CybotTM

Problem

robfig/cron/v3 is a core dependency of Ofelia (used for the entire scheduling engine), but it has been unmaintained since January 2021 (nearly 4 years).

Last commit: 2021-01-06
Repository: https://github.com/robfig/cron

Current Usage

Ofelia depends entirely on robfig/cron/v3 for:

  • Core scheduling engine (core/scheduler.go)
  • Cron expression parsing
  • Job execution timing
  • Schedule validation (including new doctor command)
// core/scheduler.go
cron := cron.New(
    cron.WithParser(
        cron.NewParser(
            cron.SecondOptional|cron.Minute|cron.Hour|
                cron.Dom|cron.Month|cron.Dow|cron.Descriptor,
        ),
    ),
    cron.WithLogger(cronUtils),
    cron.WithChain(cron.Recover(cronUtils)),
)

Risks of Unmaintained Dependency

  • Security vulnerabilities: No patches for discovered issues
  • Go compatibility: May break with future Go versions
  • Bug fixes: Known issues won't be addressed
  • Feature gaps: No support for modern cron features

Potential Alternatives

1. go-co-op/gocron

  • Repository: https://github.com/go-co-op/gocron
  • Status: Actively maintained (last commit within weeks)
  • Features:
    • Cron syntax support
    • Interval-based scheduling
    • Job tags and limiting
    • Timezone support
    • Singleton jobs
  • Migration complexity: Moderate (different API)

2. reugn/go-quartz

  • Repository: https://github.com/reugn/go-quartz
  • Status: Active maintenance
  • Features:
    • Enterprise scheduler features
    • Cron triggers
    • Job persistence
    • Clustering support
  • Migration complexity: High (very different architecture)

3. Fork robfig/cron

  • Option: Create maintained fork under Netresearch org
  • Pros: Minimal migration effort, full control
  • Cons: Maintenance burden falls on us

Scope of Work

This would be a major refactoring affecting:

  • ✅ Core scheduler (core/scheduler.go)
  • ✅ All job types (run, exec, service, local, compose)
  • ✅ Schedule parsing and validation
  • ✅ Test suite updates
  • ✅ Documentation updates
  • ✅ Migration guide for users (if syntax changes)

Recommendation

Phase 1: Evaluation (Low Risk)

  1. Research alternatives thoroughly
  2. Create proof-of-concept with top candidate
  3. Performance benchmarking
  4. Feature parity analysis
  5. Migration effort estimation

Phase 2: Decision

  • Go/No-Go based on effort vs. benefit
  • If Go: Plan migration roadmap
  • If No-Go: Document accepted risk

Phase 3: Implementation (if approved)

  • Incremental migration with feature flags
  • Comprehensive testing
  • Gradual rollout

Priority

Medium - Not urgent (robfig/cron still works), but should be addressed within next 6-12 months before technical debt compounds.

Related

  • Current dependency: github.com/robfig/cron/v3 v3.0.1
  • Recently added doctor command uses same library for validation consistency

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions