Skip to content

Commit

Permalink
Include status 401 as retryable on httpBeaconChannel
Browse files Browse the repository at this point in the history
  • Loading branch information
georgekaran committed Oct 17, 2024
1 parent 2d20534 commit 7081e79
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/channel/httpBeaconChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class HttpBeaconChannel implements DuplexChannel<string, Envelope<string,
}

private static isRetryable(status: number): boolean {
// Retry on any server error and client errors 429 (rate limit) and 408 (request timeout)
return status >= 500 || status === 429 || status === 408;
// Retry on any server error and client errors 429 (rate limit), 408 (request timeout) and 401 (unauthorized)
return status >= 500 || status === 429 || status === 408 || status === 401;
}
}
5 changes: 1 addition & 4 deletions test/channel/httpBeaconChannel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,6 @@ describe('An HTTP beacon channel', () => {
title: 'Invalid token',
log: 'Beacon rejected with non-retryable status: Invalid token',
},
{
status: 401,
title: 'Unauthorized request',
},
{
status: 402,
title: 'Payment overdue',
Expand Down Expand Up @@ -254,6 +250,7 @@ describe('An HTTP beacon channel', () => {
[408, 'Request timeout'],
[503, 'Service unavailable'],
[504, 'Gateway timeout'],
[401, 'Unauthorized'],
])('should report a retryable error if the response status is %i', async (status, title) => {
fetchMock.mock(endpointUrl, {
status: status,
Expand Down

0 comments on commit 7081e79

Please sign in to comment.