Change add to tryadd in dial
This commit is contained in:
parent
2ee3e26dd6
commit
b82c7da159
@ -28,6 +28,10 @@ func (ss *execPool) Add(ctx context.Context, f ...func()) (err error) {
|
||||
return ss.batch.Add(ctx, f...)
|
||||
}
|
||||
|
||||
func (ss *execPool) TryAdd(f ...func()) (err error) {
|
||||
return ss.batch.TryAdd(f...)
|
||||
}
|
||||
|
||||
func (ss *execPool) sendLoop() {
|
||||
for {
|
||||
f, err := ss.batch.WaitOne(context.Background())
|
||||
|
||||
@ -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)
|
||||
if dialErr != nil {
|
||||
log.InfoCtx(ctx, "can't get peers", zap.Error(dialErr))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user