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(scheduler): ensure negative intervals given to Every return an immediate error #600 #603

Merged
merged 7 commits into from
Oct 30, 2023

Conversation

husam-e
Copy link

@husam-e husam-e commented Oct 30, 2023

What does this do?

Ensures negative intervals return an immediate error.

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

Resolves #600

List any changes that modify/break current functionality

Negative intervals will now return an error.

Have you included tests for your changes?

Yes.

Did you document any new/modified functionality?

  • Updated example_test.go
  • Updated README.md

Notes

Potentially breaking change for any consumer expecting negative intervals to not return an error.

scheduler_test.go Outdated Show resolved Hide resolved
scheduler_test.go Outdated Show resolved Hide resolved
Co-authored-by: John Roesler <johnrroesler@gmail.com>
// do nothing
})

require.EqualError(t, err, ErrInvalidInterval.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

ah, the error is wrapped. So it's got another one around it. I think using require.ErrorIs should do it

Copy link
Author

Choose a reason for hiding this comment

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

thanks, I actually removed these checks as I realized there was already a bad interval test case, so I added cases to that and switched it to use contain.

scheduler_test.go Outdated Show resolved Hide resolved
scheduler_test.go Outdated Show resolved Hide resolved
scheduler_test.go Outdated Show resolved Hide resolved
scheduler_test.go Outdated Show resolved Hide resolved
@JohnRoesler JohnRoesler marked this pull request as ready for review October 30, 2023 20:31
@JohnRoesler JohnRoesler merged commit 9993f76 into go-co-op:v1 Oct 30, 2023
6 checks passed
@husam-e husam-e deleted the husam-e/negative-intervals branch October 30, 2023 20:33
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] - Handling negative time.Duration as interval param to Every func
2 participants