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

Allow more time for requestJobCtx #699

Merged

Conversation

drewgonzales360
Copy link
Contributor

@drewgonzales360 drewgonzales360 commented Mar 22, 2024

What does this do?

If you attempted to get a job and the channel was full, you were returned a nil. Instead, this code will block and wait until a job is returned or the context deadline is exceeded.

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

#695

List any changes that modify/break current functionality

Have you included tests for your changes?

Yeah.

Did you document any new/modified functionality?

  • Updated example_test.go
  • Updated README.md

Notes

@@ -44,18 +44,12 @@ func requestJob(id uuid.UUID, ch chan jobOutRequest) *internalJob {

func requestJobCtx(ctx context.Context, id uuid.UUID, ch chan jobOutRequest) *internalJob {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO, this function should throw an error if the context deadline is exceeded instead of returning nil.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah that seems reasonable. A context deadline exceeded error?

@JohnRoesler JohnRoesler merged commit b0bd435 into go-co-op:v2 Mar 23, 2024
3 checks passed
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.

None yet

2 participants