Change Add to TryAdd

This commit is contained in:
mcrakhman committed 2023-06-19 10:41:16 +02:00
1 parent 2ea446184d
commit 16be33fc96
2 files changed
+4 -2

No files matched your search

@@ -2,6 +2,7 @@ package synctree
import (
"context"
"github.com/anyproto/any-sync/app/logger"
"github.com/anyproto/any-sync/commonspace/object/tree/objecttree"
"github.com/anyproto/any-sync/commonspace/object/tree/treechangeproto"
+3 -2
View File
@@ -2,11 +2,12 @@ package streampool
import (
"context"
"sync/atomic"
"github.com/anyproto/any-sync/app/logger"
"github.com/cheggaaa/mb/v3"
"go.uber.org/zap"
"storj.io/drpc"
"sync/atomic"
)
type stream struct {
@@ -22,7 +23,7 @@ type stream struct {
}
func (sr *stream) write(msg drpc.Message) (err error) {
return sr.queue.Add(sr.stream.Context(), msg)
return sr.queue.TryAdd(sr.stream.Context(), msg)
}
func (sr *stream) readLoop() error {