Skip to content

Commit

Permalink
Merge branch 'master' into state-recovery
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz authored Feb 1, 2024
2 parents ea34814 + b9043c4 commit e727c02
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion util/rpcclient/rpcclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,26 @@ func (c *RpcClient) CallContext(ctx_in context.Context, result interface{}, meth
ctx, cancelCtx = context.WithCancel(ctx_in)
}
err = c.client.CallContext(ctx, result, method, args...)

cancelCtx()
logger := log.Trace
limit := int(c.config().ArgLogLimit)
if err != nil && err.Error() != "already known" {
logger = log.Info
}
logger("rpc response", "method", method, "logId", logId, "err", err, "result", limitedMarshal{limit, result}, "attempt", i, "args", limitedArgumentsMarshal{limit, args})
logEntry := []interface{}{
"method", method,
"logId", logId,
"err", err,
"result", limitedMarshal{limit, result},
"attempt", i,
"args", limitedArgumentsMarshal{limit, args},
}
var dataErr rpc.DataError
if errors.As(err, &dataErr) {
logEntry = append(logEntry, "errorData", limitedMarshal{limit, dataErr.ErrorData()})
}
logger("rpc response", logEntry...)
if err == nil {
return nil
}
Expand Down

0 comments on commit e727c02

Please sign in to comment.