Skip to content

Commit

Permalink
Use chStopInFlight
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanTinianov committed Jan 10, 2025
1 parent 5e53423 commit 988f9b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions multinode/adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ func (m *Adapter[RPC, HEAD]) LenSubs() int {
}

// RegisterSub adds the sub to the Adaptor list and returns a sub which is managed on unsubscribe
func (m *Adapter[RPC, HEAD]) RegisterSub(sub Subscription, stopInFLightCh chan struct{}) (*ManagedSubscription, error) {
func (m *Adapter[RPC, HEAD]) RegisterSub(sub Subscription) (*ManagedSubscription, error) {
// ensure that the `sub` belongs to current life cycle of the `rpcMultiNodeAdapter` and it should not be killed due to
// previous `DisconnectAll` call.
select {
case <-stopInFLightCh:
case <-m.chStopInFlight:
sub.Unsubscribe()
return nil, fmt.Errorf("failed to register subscription - all in-flight requests were canceled")
default:
Expand Down
4 changes: 0 additions & 4 deletions multinode/adaptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ func LatestBlock(ctx context.Context, rpc *testRPC) (*testHead, error) {
return &testHead{rpc.latestBlock}, nil
}

func ptr[T any](t T) *T {
return &t
}

func newTestClient(t *testing.T) *Adapter[testRPC, *testHead] {
requestTimeout := 5 * time.Second
lggr := logger.Test(t)
Expand Down

0 comments on commit 988f9b2

Please sign in to comment.