Skip to content

enhancement: add job priority/ordering support #212

@CybotTM

Description

@CybotTM

Description

When multiple jobs are scheduled for the same time, there's no way to control execution order.

Current Behavior

Jobs scheduled for the same time execute in arbitrary order based on heap implementation.

Proposed Enhancement

// Priority option (higher = runs first)
c.AddFunc("@daily", highPriorityJob, cron.WithPriority(10))
c.AddFunc("@daily", lowPriorityJob, cron.WithPriority(1))

// Or dependency-based
c.AddFunc("@daily", jobB, cron.After(jobAID))  // See #192

// Or explicit ordering
c.AddFunc("@daily", job1, cron.WithOrder(1))
c.AddFunc("@daily", job2, cron.WithOrder(2))

Use Cases

  • Run cleanup jobs before main jobs
  • Ensure resource preparation before consumers
  • Predictable execution order for testing
  • Priority scheduling under load

Severity

🟢 Low - Feature enhancement

Found By

Pre-1.0 release code review with Zen/Gemini

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiAPI design changesenhancementNew feature or requestneeds-discussionRequires discussion or approval before implementation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions