diff --git a/go.mod b/go.mod index fceb9e2..6f70751 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/gobwas/httphead v0.1.0 github.com/gobwas/ws v1.2.0 github.com/mailru/easyjson v0.7.7 - github.com/puzpuzpuz/xsync/v2 v2.5.1 + github.com/puzpuzpuz/xsync/v3 v3.0.2 github.com/tidwall/gjson v1.14.4 github.com/tyler-smith/go-bip32 v1.0.0 github.com/tyler-smith/go-bip39 v1.1.0 diff --git a/go.sum b/go.sum index d2189f5..e2587e2 100644 --- a/go.sum +++ b/go.sum @@ -79,8 +79,8 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/puzpuzpuz/xsync/v2 v2.5.1 h1:mVGYAvzDSu52+zaGyNjC+24Xw2bQi3kTr4QJ6N9pIIU= -github.com/puzpuzpuz/xsync/v2 v2.5.1/go.mod h1:gD2H2krq/w52MfPLE+Uy64TzJDVY7lP2znR9qmR35kU= +github.com/puzpuzpuz/xsync/v3 v3.0.2 h1:3yESHrRFYr6xzkz61LLkvNiPFXxJEAABanTQpKbAaew= +github.com/puzpuzpuz/xsync/v3 v3.0.2/go.mod h1:VjzYrABPabuM4KyBh1Ftq6u8nhwY5tBPKP9jpmh0nnA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= diff --git a/pool.go b/pool.go index f690de0..e2825fb 100644 --- a/pool.go +++ b/pool.go @@ -8,7 +8,7 @@ import ( "sync" "time" - "github.com/puzpuzpuz/xsync/v2" + "github.com/puzpuzpuz/xsync/v3" ) const ( @@ -37,7 +37,7 @@ func NewSimplePool(ctx context.Context, opts ...PoolOption) *SimplePool { ctx, cancel := context.WithCancel(ctx) pool := &SimplePool{ - Relays: xsync.NewMapOf[*Relay](), + Relays: xsync.NewMapOf[string, *Relay](), Context: ctx, cancel: cancel, @@ -100,7 +100,7 @@ func (pool *SimplePool) subMany(ctx context.Context, urls []string, filters Filt ctx, cancel := context.WithCancel(ctx) _ = cancel // do this so `go vet` will stop complaining events := make(chan IncomingEvent) - seenAlready := xsync.NewMapOf[Timestamp]() + seenAlready := xsync.NewMapOf[string, Timestamp]() ticker := time.NewTicker(seenAlreadyDropTick) eose := false @@ -222,7 +222,7 @@ func (pool *SimplePool) subManyEose(ctx context.Context, urls []string, filters ctx, cancel := context.WithCancel(ctx) events := make(chan IncomingEvent) - seenAlready := xsync.NewMapOf[bool]() + seenAlready := xsync.NewMapOf[string, bool]() wg := sync.WaitGroup{} wg.Add(len(urls)) diff --git a/relay.go b/relay.go index f65f423..5ce9757 100644 --- a/relay.go +++ b/relay.go @@ -12,7 +12,7 @@ import ( "github.com/gobwas/ws" "github.com/gobwas/ws/wsutil" - "github.com/puzpuzpuz/xsync/v2" + "github.com/puzpuzpuz/xsync/v3" ) type Status int @@ -55,8 +55,8 @@ func NewRelay(ctx context.Context, url string, opts ...RelayOption) *Relay { URL: NormalizeURL(url), connectionContext: ctx, connectionContextCancel: cancel, - Subscriptions: xsync.NewMapOf[*Subscription](), - okCallbacks: xsync.NewMapOf[func(bool, string)](), + Subscriptions: xsync.NewMapOf[string, *Subscription](), + okCallbacks: xsync.NewMapOf[string, func(bool, string)](), writeQueue: make(chan writeRequest), subscriptionChannelCloseQueue: make(chan *Subscription), }