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

[BUG] Fix Data race when using RunByTag #356

Merged
merged 2 commits into from
Jul 20, 2022
Merged

[BUG] Fix Data race when using RunByTag #356

merged 2 commits into from
Jul 20, 2022

Conversation

seunghyupoh3517
Copy link

@seunghyupoh3517 seunghyupoh3517 commented Jul 19, 2022

What does this do?

Resolves #350 Job lastRun was causing the data race when RunByTag. Wraps the job.copy in Scheduler.run() into separate method, addJobDetails and added locks on job.runCount, job.lastRun.

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

Resolves #350

List any changes that modify/break current functionality

Have you included tests for your changes?

Updated TestScheduler_RunByTag in shceduler_test.go to simulate multiple tasks being run by tag.

Did you document any new/modified functionality?

  • Updated example_test.go
  • Updated README.md

Notes

Added ErrInvalidFunctionParameters = errors.New("length of function parameters must match job function parameters") But if this case will never be happening, update the job.error. Otherwise, it would be better to return the error.

@seunghyupoh3517
Copy link
Author

Minor format changes are gofumpt-ed.

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.

looks good - thank you!

@JohnRoesler JohnRoesler merged commit cf9e6c3 into go-co-op:main Jul 20, 2022
@seunghyupoh3517
Copy link
Author

@JohnRoesler Thanks for the review & merge! Do you by any chance have an insight of when the change will be released?

@JohnRoesler
Copy link
Contributor

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] - Data race when using RunByTag
2 participants