forked from robfig/cron
-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
enhancementNew feature or requestNew feature or requestupstreamIssues from upstream robfig/cronIssues from upstream robfig/cron
Description
Summary
Add option to run a job immediately when it's added, rather than waiting for the first scheduled time.
Upstream Reference
- PR: feat: add
ScheduleEntryNowfunction to trigger entry immediately outside of schedule robfig/cron#511 - ScheduleEntryNow
Related Issues
- This is related to feat: Add WithPrev and WithRunImmediately entry options #221 (WithPrev option from feat: support overriding the Prev time for a new job/entry robfig/cron#446) which tracks previous execution time
- This is related to feat: Add schedule.Prev() method for previous execution time #222 (WithRunImmediately from add schedule.Prev() robfig/cron#361)
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestupstreamIssues from upstream robfig/cronIssues from upstream robfig/cron