Merge branch 'main' of github.com:anytypeio/any-sync into GO-800-nodes-configuration

This commit is contained in:
Sergey Cherepanov 2023-04-13 19:06:22 +02:00
commit eb8f760370
No known key found for this signature in database
GPG Key ID: 87F8EDE8FBDF637C
2 changed files with 5 additions and 1 deletions

View File

@ -28,6 +28,10 @@ func (ss *execPool) Add(ctx context.Context, f ...func()) (err error) {
return ss.batch.Add(ctx, f...) return ss.batch.Add(ctx, f...)
} }
func (ss *execPool) TryAdd(f ...func()) (err error) {
return ss.batch.TryAdd(f...)
}
func (ss *execPool) sendLoop() { func (ss *execPool) sendLoop() {
for { for {
f, err := ss.batch.WaitOne(context.Background()) f, err := ss.batch.WaitOne(context.Background())

View File

@ -117,7 +117,7 @@ func (s *streamPool) Send(ctx context.Context, msg drpc.Message, peerGetter Peer
} }
} }
} }
return s.dial.Add(ctx, func() { return s.dial.TryAdd(func() {
peers, dialErr := peerGetter(ctx) peers, dialErr := peerGetter(ctx)
if dialErr != nil { if dialErr != nil {
log.InfoCtx(ctx, "can't get peers", zap.Error(dialErr)) log.InfoCtx(ctx, "can't get peers", zap.Error(dialErr))