Stream pool and synctree fixes

This commit is contained in:
mcrakhman 2022-10-24 10:31:29 +02:00 committed by Mikhail Iudin
parent 500725ffee
commit 453967fad8
No known key found for this signature in database
GPG Key ID: FAAAA8BAABDFF1C0
2 changed files with 5 additions and 5 deletions

View File

@ -98,7 +98,7 @@ func (s *streamPool) SendSync(
delete(s.waiters, msg.ReplyId)
s.waitersMx.Unlock()
log.With("trackingId", msg.ReplyId).Error("time elapsed when waiting")
log.With("replyId", msg.ReplyId).Error("time elapsed when waiting")
err = ErrSyncTimeout
case reply = <-waiter.ch:
if !delay.Stop() {
@ -226,17 +226,17 @@ func (s *streamPool) readPeerLoop(peerId string, stream spacesyncproto.SpaceStre
s.messageHandler(stream.Context(), peerId, msg)
return
}
log.With("trackingId", msg.ReplyId).Debug("getting message with tracking id")
log.With("replyId", msg.ReplyId).Debug("getting message with reply id")
s.waitersMx.Lock()
waiter, exists := s.waiters[msg.ReplyId]
if !exists {
log.With("trackingId", msg.ReplyId).Debug("tracking id not exists")
log.With("replyId", msg.ReplyId).Debug("reply id not exists")
s.waitersMx.Unlock()
s.messageHandler(stream.Context(), peerId, msg)
return
}
log.With("trackingId", msg.ReplyId).Debug("tracking id exists")
log.With("replyId", msg.ReplyId).Debug("reply id exists")
delete(s.waiters, msg.ReplyId)
s.waitersMx.Unlock()

View File

@ -125,7 +125,7 @@ func BuildSyncTreeOrGetRemote(ctx context.Context, id string, deps BuildDeps) (t
}
resp, err := deps.StreamPool.SendSync(peerId, objMsg)
if resp != nil {
if err != nil {
return
}
msg = &treechangeproto.TreeSyncMessage{}