Skip to content

feat: Run job immediately on add (ScheduleEntryNow) #228

Description

@CybotTM

Summary

Add option to run a job immediately when it's added, rather than waiting for the first scheduled time.

Upstream Reference

Related Issues

Note: #221 and #222 may already cover this use case. This issue tracks the specific ScheduleEntryNow approach from PR robfig#511.

Problem

When adding a job that runs infrequently (e.g., daily), users often want it to execute immediately for:

  • Initial data population
  • Testing/validation
  • Ensuring timely first execution

Proposed API

// Option 1: ScheduleEntryNow function
c.ScheduleEntryNow(entry)

// Option 2: AddFunc with immediate flag
c.AddFunc("@daily", myFunc, cron.WithImmediate())

// Option 3: Entry method
entry := c.Entry(id)
entry.RunNow()

Priority

Medium - Common requirement for job initialization.

Implementation Notes

Consider interaction with SkipIfStillRunning and DelayIfStillRunning wrappers.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestupstreamIssues from upstream robfig/cron

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions