1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-07 21:47:02 +09:00

Merge pull request #318 from anyproto/GO-4304-fix-error-handling

GO-4304: Fix error handling
This commit is contained in:
Mikhail Rakhmanov 2024-10-18 12:14:43 +02:00 committed by GitHub
commit f09291531f
Signed by: github
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -23,6 +23,7 @@ import (
"github.com/anyproto/any-sync/commonspace/syncstatus"
"github.com/anyproto/any-sync/net/peer"
"github.com/anyproto/any-sync/net/pool"
"github.com/anyproto/any-sync/net/rpc/rpcerr"
"github.com/anyproto/any-sync/net/secureservice"
)
@ -187,7 +188,7 @@ func (o *objectSync) SendStreamRequest(ctx context.Context, rq syncdeps.Request,
if err != nil {
return err
}
return pr.DoDrpc(ctx, func(conn drpc.Conn) error {
err = pr.DoDrpc(ctx, func(conn drpc.Conn) error {
cl := spacesyncproto.NewDRPCSpaceSyncClient(conn)
res, err := rq.Proto()
if err != nil {
@ -203,4 +204,9 @@ func (o *objectSync) SendStreamRequest(ctx context.Context, rq syncdeps.Request,
}
return receive(stream)
})
if err != nil {
err = rpcerr.Unwrap(err)
return
}
return
}

View file

@ -79,7 +79,7 @@ func (r *requestManager) QueueRequest(rq syncdeps.Request) error {
r.requestPool.Add(rq.PeerId(), rq.ObjectId(), func(ctx context.Context) {
err := r.handler.ApplyRequest(ctx, rq, r)
if err != nil {
log.Error("failed to apply request", zap.Error(err), zap.String("peerId", rq.PeerId()), zap.String("objectId", rq.ObjectId()))
log.Debug("failed to apply request", zap.Error(err), zap.String("peerId", rq.PeerId()), zap.String("objectId", rq.ObjectId()))
}
}, func() {
r.metric.UpdateQueueSize(size, syncdeps.MsgTypeOutgoingRequest, false)