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 calculateMonths #104

Merged
merged 5 commits into from
Feb 3, 2021
Merged

fix calculateMonths #104

merged 5 commits into from
Feb 3, 2021

Conversation

leoshus
Copy link

@leoshus leoshus commented Jan 22, 2021

when we use every month at some time,then calculate next run time use base time is not consistency

What does this do?

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

List any changes that modify/break current functionality

Have you included tests for your changes?

Did you document any new/modified functionality?

  • Updated example_test.go
  • Updated README.md

Notes

Copy link
Member

@arjunmahishi arjunmahishi left a comment

Choose a reason for hiding this comment

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

Hey @sdw2330976, thanks for your contribution! 🎉

scheduler.go Show resolved Hide resolved
JohnRoesler
JohnRoesler previously approved these changes Feb 1, 2021
Copy link
Contributor

@JohnRoesler JohnRoesler left a comment

Choose a reason for hiding this comment

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

lgtm

@JohnRoesler JohnRoesler dismissed their stale review February 2, 2021 22:50

i think the tests could use some enhancements

scheduler_test.go Outdated Show resolved Hide resolved
@@ -191,7 +191,7 @@ func (s *Scheduler) calculateMonths(job *Job, lastRun time.Time) time.Duration {
nextRun = nextRun.AddDate(0, int(job.interval), daysDifference)
}
}
return s.until(lastRunRoundedMidnight, nextRun)
return s.until(lastRun, nextRun)
Copy link
Contributor

Choose a reason for hiding this comment

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

@sdw2330976 do you have a time scenario where this fails with lastRunRoundedMidnight? We can fake the time for a test, but ideally we could prove the old logic doesn't work with our test

@JohnRoesler JohnRoesler merged commit ec0c59e into go-co-op:master Feb 3, 2021
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