-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Unify usage of context in slasher client #5684
Conversation
Build fails |
did you try it in runtime? |
Yes! Gets cancelled instantly, before it would always hand and I'd have to manually interrupt it. |
slasher/beaconclient/receivers.go
Outdated
@@ -134,6 +134,10 @@ func (bs *Service) collectReceivedAttestations(ctx context.Context) { | |||
case att := <-bs.receivedAttestationsBuffer: | |||
atts = append(atts, att) | |||
case collectedAtts := <-bs.collectedAttestationsBuffer: | |||
if err := ctx.Err(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is in a for select block <-ctx.Err(): should be its own case
slasher/detection/listeners.go
Outdated
@@ -56,6 +56,10 @@ func (ds *Service) detectIncomingAttestations(ctx context.Context, ch chan *ethp | |||
for { | |||
select { | |||
case indexedAtt := <-ch: | |||
if err := ctx.Err(); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 as above
slasher/detection/service.go
Outdated
@@ -93,7 +93,7 @@ func (ds *Service) Start() { | |||
// our gRPC client to keep detecting slashable offenses. | |||
go ds.detectIncomingBlocks(ds.ctx, ds.blocksChan) | |||
go ds.detectIncomingAttestations(ds.ctx, ds.attsChan) | |||
go ds.detectHistoricalChainData(ds.ctx) | |||
//go ds.detectHistoricalChainData(ds.ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plz no commented code
…slasher-unify-ctx
…prysm into slasher-unify-ctx
Codecov Report
@@ Coverage Diff @@
## master #5684 +/- ##
===========================================
- Coverage 54.14% 12.76% -41.39%
===========================================
Files 311 117 -194
Lines 25982 9132 -16850
===========================================
- Hits 14069 1166 -12903
+ Misses 9859 7818 -2041
+ Partials 2054 148 -1906 |
What type of PR is this?
Improvement
What does this PR do? Why is it needed?
This mirrors #5671 to the slasher client, to ensure SIGTERM cancels when it should be, and also makes sure the wrong context isn't passed into functions.