Skip to content

perf(grpc-js): avoid redundant metadata clone in RetryingCall on initial attempt - #3101

Open
olavloite wants to merge 1 commit into
grpc:masterfrom
olavloite:avoid-cloning-metadata-on-first-attempt
Open

olavloite wants to merge 1 commit into
grpc:masterfrom
olavloite:avoid-cloning-metadata-on-first-attempt

Conversation

@olavloite

Copy link
Copy Markdown
Contributor

RetryingCall.startNewAttempt() previously cloned this.initialMetadata on every attempt, even when previousAttempts was 0 and no grpc-previous-rpc-attempts header needed to be added. Because LoadBalancingCall never mutates this.metadata and always clones it in doPick(), the extra clone in RetryingCall on the initial attempt was redundant.

Only clone this.initialMetadata in RetryingCall.startNewAttempt() when previousAttempts > 0.

…ial attempt

RetryingCall.startNewAttempt() previously cloned this.initialMetadata on every
attempt, even when previousAttempts was 0 and no grpc-previous-rpc-attempts
header needed to be added. Because LoadBalancingCall never mutates this.metadata
and always clones it in doPick(), the extra clone in RetryingCall on the initial
attempt was redundant.

Only clone this.initialMetadata in RetryingCall.startNewAttempt() when
previousAttempts > 0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant