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

fix nextRun with singleton mode reporting incorrect time #705

Merged
merged 3 commits into from
Apr 6, 2024

Conversation

JohnRoesler
Copy link
Contributor

What does this do?

adjusts how the nextScheduledRun field is tracked. Rather than being a single time.Time field it is now a slice of time.Time. This allows for the case, that will often happen with limited/singleton jobs that may be queued up. In this case, there are multiple nextScheduledRun values.

Which issue(s) does this PR fix/relate to?

resolves #704

List any changes that modify/break current functionality

Have you included tests for your changes?

yes - thank you @aneesh1 for the excellent ticket write up and test case

Did you document any new/modified functionality?

  • Updated example_test.go
  • Updated README.md

Notes

scheduler.go Outdated Show resolved Hide resolved
@aneesh1
Copy link

aneesh1 commented Mar 29, 2024

(If you already have a test for this, feel free to ignore) Do we have / can we add a test where a job runs longer than the specified duration and the next job has to wait to highlight the expected behavior?

Ex:

  • Add DurationJob(5 * time.Second)
  • t0: startJob (expecting job to run again at t5)
  • t5: job is still running, so it’s skipped
  • t7: job finishes
  • t10: next job starts

cc @drewgonzales360

Copy link
Contributor

@drewgonzales360 drewgonzales360 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the hard work on this 🙏

job.go Show resolved Hide resolved
scheduler.go Outdated Show resolved Hide resolved
scheduler.go Show resolved Hide resolved
job_test.go Outdated Show resolved Hide resolved
@JohnRoesler JohnRoesler merged commit 3b653b9 into v2 Apr 6, 2024
3 checks passed
@JohnRoesler JohnRoesler deleted the fix-nextRun branch April 6, 2024 01:56
@JohnRoesler
Copy link
Contributor Author

When you all could, please validate it's working as expected for you: v2.2.10-rc1

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.

[BUG] - Time reported by NextRun when running WithSingletonMode and WithStartDateTime incorrect
3 participants