Skip to content

Commit

Permalink
fix newHeads unsubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
tudor-malene committed May 7, 2024
1 parent f1b6be4 commit 067517d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
3 changes: 0 additions & 3 deletions go/common/subscription/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,5 @@ func ForwardFromChannels[R any](inputChannels []chan R, unsubscribed *atomic.Boo
// Must be called as a go routine!
func HandleUnsubscribe(connectionSub *rpc.Subscription, unsubscribed *atomic.Bool, onUnsub func()) {
<-connectionSub.Err()
if unsubscribed != nil {
unsubscribed.Store(true)
}
onUnsub()
}
1 change: 1 addition & 0 deletions go/host/rpc/clientapi/client_api_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func (api *FilterAPI) Logs(ctx context.Context, encryptedParams common.Encrypted
})
go subscriptioncommon.HandleUnsubscribe(subscription, &unsubscribed, func() {
api.host.UnsubscribeLogs(subscription.ID)
unsubscribed.Store(true)
})
return subscription, nil
}
Expand Down
4 changes: 1 addition & 3 deletions go/node/docker_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import (
"github.com/ten-protocol/go-ten/go/common/docker"
)

var (
_enclaveDataDir = "/enclavedata" // this is how the directory is references within the enclave container
)
var _enclaveDataDir = "/enclavedata" // this is how the directory is references within the enclave container

type DockerNode struct {
cfg *Config
Expand Down
1 change: 1 addition & 0 deletions tools/walletextension/rpcapi/filter_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func (api *FilterAPI) Logs(ctx context.Context, crit common.FilterCriteria) (*rp
for _, connection := range backendWSConnections {
_ = returnConn(api.we.rpcWSConnPool, connection.BackingClient())
}
unsubscribed.Store(true)
})

return subscription, err
Expand Down

0 comments on commit 067517d

Please sign in to comment.