Skip to content

Commit 4f7b7e4

Browse files
mo4islonaclaude
andcommitted
Address review: clarify durationMs scope and handle batch methods
- Add comment clarifying durationMs is per-attempt, not cumulative - For batch calls, join all method names and include rpcBatchSize Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent de01523 commit 4f7b7e4

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

util/rpc-client/src/client.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ export class RpcClient {
402402
}
403403
req.resolve(result)
404404
}, err => {
405+
// Duration of this individual send attempt (not cumulative across retries)
405406
let durationMs = Date.now() - startTime
406407
if (this.closed) return req.reject(this.enrichError(err, req, durationMs))
407408
if (this.isConnectionError(err)) {
@@ -512,10 +513,20 @@ export class RpcClient {
512513
}
513514

514515
private enrichError(err: Error, req: Req, durationMs: number): Error {
515-
let call = Array.isArray(req.call) ? req.call[0] : req.call
516+
let rpcMethod: string
517+
let rpcBatchSize: number | undefined
518+
519+
if (Array.isArray(req.call)) {
520+
rpcBatchSize = req.call.length
521+
rpcMethod = req.call.map(c => c.method).join(',')
522+
} else {
523+
rpcMethod = req.call.method
524+
}
525+
516526
return addErrorContext(err, {
517527
rpcUrl: this.url,
518-
rpcMethod: call.method,
528+
rpcMethod,
529+
rpcBatchSize,
519530
durationMs
520531
})
521532
}

0 commit comments

Comments
 (0)