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

Add timeout support on send #148

Merged
merged 8 commits into from
Dec 15, 2023
Merged

Add timeout support on send #148

merged 8 commits into from
Dec 15, 2023

Conversation

egorse
Copy link
Contributor

@egorse egorse commented Dec 11, 2023

Add internal/errorgrp package to support cancellable error groups
Add tests for push/pull timeout

Add internal/errorgrp package to support cancellable error groups
Add tests for push/pull timeout
Copy link

codecov bot commented Dec 11, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (e16dc3e) 68.51% compared to head (2bf3109) 68.07%.

Files Patch % Lines
rep.go 50.00% 1 Missing ⚠️
req.go 50.00% 1 Missing ⚠️
socket.go 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #148      +/-   ##
==========================================
- Coverage   68.51%   68.07%   -0.44%     
==========================================
  Files          29       30       +1     
  Lines        2560     2600      +40     
==========================================
+ Hits         1754     1770      +16     
- Misses        704      727      +23     
- Partials      102      103       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@sbinet sbinet 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 putting this together.

according to codecov:
https://app.codecov.io/gh/go-zeromq/zmq4/pull/148/blob/internal/errorgrp/errorgrp.go

we don't exercize the whole errorgrp.Group2.Go code.
we could probably try to make sure we still get the context error when it expires during the execution of f.
(probably with a 2-level handshake where the cancel() happens when we are sure f is being executed)

internal/errorgrp/errorgrp.go Outdated Show resolved Hide resolved
internal/errorgrp/errorgrp.go Outdated Show resolved Hide resolved
internal/errorgrp/errorgrp.go Outdated Show resolved Hide resolved
zmq4_timeout_test.go Show resolved Hide resolved
zmq4_timeout_test.go Outdated Show resolved Hide resolved
internal/errorgrp/errorgrp.go Outdated Show resolved Hide resolved
internal/errorgrp/errorgrp_test.go Outdated Show resolved Hide resolved
internal/errorgrp/errorgrp_test.go Outdated Show resolved Hide resolved
internal/errorgrp/errorgrp_test.go Outdated Show resolved Hide resolved
internal/errorgrp/errorgrp_test.go Outdated Show resolved Hide resolved
@egorse
Copy link
Contributor Author

egorse commented Dec 12, 2023

we don't exercize the whole errorgrp.Group2.Go code.
we could probably try to make sure we still get the context error when it expires during the execution of f.
(probably with a 2-level handshake where the cancel() happens when we are sure f is being executed)

This is sort of odd - I had impression that only block execution of f if context is already cancelled (i.e. if the eg has limits on number of executable functions and parent context got cancelled prior next f in eg started).
I will check it and update PR (include others suggestions)

update: Test case was missing

@egorse
Copy link
Contributor Author

egorse commented Dec 12, 2023

I think its ready for next review cycle. Please comment

internal/errgroup/errgroup.go Show resolved Hide resolved
internal/errgroup/errgroup.go Outdated Show resolved Hide resolved
zmq4_timeout_test.go Outdated Show resolved Hide resolved
Unfortunatelly the errgroup.Group is not copyable so
had to handle implicity initialization in all methods.
@egorse
Copy link
Contributor Author

egorse commented Dec 13, 2023

Please take a look. Still not sure how well it is on implicit errgroup.Group initialization

@egorse
Copy link
Contributor Author

egorse commented Dec 13, 2023

Dough - original init() was nicer for codecov. Will wait for your comments

The fix is similar to one of previous commit with deadlock fix
Copy link
Contributor

@sbinet sbinet left a comment

Choose a reason for hiding this comment

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

LGTM

thanks a lot for the PR.

@sbinet sbinet merged commit 16ca7c0 into go-zeromq:main Dec 15, 2023
1 of 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.

2 participants