Skip to content

Conversation

@NickTaporuk
Copy link

@NickTaporuk NickTaporuk commented Oct 17, 2024

Hi guys.

I've prepared the pull request to resolve an issue with init the cron after restart.

Please make a review as it be possible.

@NickTaporuk NickTaporuk marked this pull request as ready for review October 17, 2024 08:59
@NickTaporuk
Copy link
Author

Hi guys.

Title: Add WithEntries Option to Support Job Restoration After App Reboot

Description:

This PR introduces a new option WithEntries to the github.com/robfig/cron package, which allows the use of pre-existing entries when initializing the cron scheduler. This is particularly useful in scenarios where the application restarts, and you want to maintain the previous job schedules without recalculating or losing them.

Key Change:

// WithEntries uses the provided entries.
func WithEntries(entries []*Entry) Option {
    return func(c *Cron) {
        c.entries = entries
    }
}

WithEntries: This function provides an option to load an existing set of entries ([]*Entry) into the cron scheduler during initialization. This enables the cron jobs to continue running from where they left off before the reboot, preserving the schedule’s state across restarts.

@flc1125
Copy link

flc1125 commented Nov 1, 2024

I made improvements to this repository and released version 4.0.0, which supports context. Context`。

Welcome to use. flc1125/go-cron


Based on the fact that this warehouse has been in disrepair all year round.

If you are interested, I really hope that your request can also be merged into 4.x. Welcome to maintain together.

@NickTaporuk
Copy link
Author

NickTaporuk commented Nov 1, 2024 via email

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