Skip to content

Add support to run job NOW AND LATER instead of just LATER #439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
opslock-benjamin opened this issue Feb 10, 2022 · 2 comments
Open

Add support to run job NOW AND LATER instead of just LATER #439

opslock-benjamin opened this issue Feb 10, 2022 · 2 comments

Comments

@opslock-benjamin
Copy link

After reading the docs I couldn't find a way to run crons now as soon as i start , and then later at the next interval.

Is there a way to do this currently?

If not I think its a worthy feature to test code easier instead of modifying 1000 registered functions to run every 1 second

@zeewell
Copy link

zeewell commented Mar 11, 2022

#436

@alaingilbert
Copy link

@opslock-benjamin I made a fork of this repo that addresses almost all issues of this repo.
https://github.com/alaingilbert/cron

This is how you could do what you want to do ->

_, _ = c.AddJob("*/10 * * * * *", func() {
    fmt.Println("this job runs as soon as cron is started, then at every 10th seconds", time.Now())
}, cron.RunOnStart)

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

No branches or pull requests

3 participants