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:
commit
f09291531f
2 changed files with 8 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue