Skip to content

Commit f9c8f5f

Browse files
committed
chore: update ResponseMetadata.retries to attempts
1 parent 7d63dea commit f9c8f5f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

packages/middleware-retry/src/defaultStrategy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class ExponentialBackOffStrategy implements RetryStrategy {
5252
while (true) {
5353
try {
5454
const { response, output } = await next(args);
55-
output.$metadata.retries = attempts;
55+
output.$metadata.attempts = attempts + 1;
5656
output.$metadata.totalRetryDelay = totalDelay;
5757

5858
return { response, output };
@@ -75,7 +75,7 @@ export class ExponentialBackOffStrategy implements RetryStrategy {
7575
err.$metadata = {};
7676
}
7777

78-
err.$metadata.retries = attempts;
78+
err.$metadata.attempts = attempts;
7979
err.$metadata.totalRetryDelay = totalDelay;
8080
throw err;
8181
}

packages/middleware-retry/src/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe("retryMiddleware", () => {
1919
const {
2020
output: { $metadata }
2121
} = await retryHandler({ input: {}, request: new HttpRequest({}) });
22-
expect($metadata.retries).toBe(0);
22+
expect($metadata.attempts).toBe(1);
2323
expect($metadata.totalRetryDelay).toBe(0);
2424

2525
expect(next.mock.calls.length).toBe(1);

packages/types/src/response.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ export interface ResponseMetadata {
2828
cfId?: string;
2929

3030
/**
31-
* The number of times this operation was retried.
31+
* The number of times this operation was attempted.
3232
*/
33-
retries?: number;
33+
attempts?: number;
3434

3535
/**
3636
* The total amount of time (in milliseconds) that was spent waiting between

0 commit comments

Comments
 (0)