Skip to content
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

[FEATURE] - Interval job to optionally include job duration #565

Open
JohnRoesler opened this issue Sep 10, 2023 Discussed in #564 · 0 comments
Open

[FEATURE] - Interval job to optionally include job duration #565

JohnRoesler opened this issue Sep 10, 2023 Discussed in #564 · 0 comments
Labels
enhancement New feature or request

Comments

@JohnRoesler
Copy link
Contributor

Discussed in #564

Originally posted by FireSmack September 10, 2023
I have a job set to run every 5 minutes:

s := gocron.NewScheduler(time.UTC)
job, err := s.Every(5).Minutes().Do(task)
if err != nil {
    log.Fatalf("Job %v, Error: %v", job, err)
}

I do not use WaitForSchedule() or WaitForScheduleAll().

I would like my task to always run 5 minutes after the previous iteration finishes, not every 5 minutes regardless of how long the previous run took.

Example:

Let's say the first execution of my job starts at 09:00:10 and ends at 09:00:20. The next execution will start at 9:05:10. However, is it possible to have the next execution start 5 minutes after the previous one finishes, so that the next one starts at 9:05:20? And then if that one finished at 09:05:35, I would want the following one to start at 09:10:35, not at 09:10:10. Is this possible?

@JohnRoesler JohnRoesler added v1 enhancement New feature or request labels Oct 28, 2023
@JohnRoesler JohnRoesler added v2 and removed v1 labels Dec 21, 2023
@JohnRoesler JohnRoesler removed the v2 label May 24, 2024
@JohnRoesler JohnRoesler changed the title FEATURE: Interval job to optionally include job duration [FEATURE] Interval job to optionally include job duration May 24, 2024
@JohnRoesler JohnRoesler changed the title [FEATURE] Interval job to optionally include job duration [FEATURE] - Interval job to optionally include job duration May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant