fix: separate T-Bank RPC network time from queue wait (WealthLedger/backend#81) (#94)
Backend verify / commits (push) Skipped
Backend verify / security (push) Successful in 11s
Backend verify / verify (push) Successful in 5m20s

This commit was merged in pull request #94.
This commit is contained in:
2026-10-15 05:41:21 +03:00
parent 6975853656
commit 0d7839cf79
3 changed files with 9 additions and 2 deletions
+6 -2
View File
@@ -64,6 +64,7 @@ type TbankClientService = Client & Record<string, Unary<never, never>>;
type RpcDiagnostics = {
channelState?: string;
headersReceived?: boolean;
networkMs?: number;
queueWaitMs?: number;
trackingId?: string;
};
@@ -524,10 +525,13 @@ export class TbankClient {
throw new ServiceUnavailableException({ code: TbankErrorCode.Unavailable });
}
const response = await this.queue.run(() => {
diagnostics.queueWaitMs = Math.round(performance.now() - startedAt);
const sentAt = performance.now();
diagnostics.queueWaitMs = Math.round(sentAt - startedAt);
return this.request<Response>(
token, client, method, request, diagnostics,
);
).finally(() => {
diagnostics.networkMs = Math.round(performance.now() - sentAt);
});
});
this.logger.event('debug', 'tbank.rpc.completed', {
operation: method,