Skip to content

Commit

Permalink
fix: retry in case of http error 524 timeout (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
petermm authored Jun 14, 2024
1 parent 6bd2f7b commit 4cb2711
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/APIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export class APIClient {
this.socket.close();
const RequestTimeout = 408;
const ServiceUnavailable = 503;
if (res.statusCode === ServiceUnavailable || res.statusCode === RequestTimeout) {
const CfRequestTimeout = 524;
if (res.statusCode === ServiceUnavailable || res.statusCode === RequestTimeout || res.statusCode === CfRequestTimeout) {
console.warn(
`Connection to ${this.server} failed: ${res.statusMessage ?? ''} (${res.statusCode}).`,
);
Expand Down

0 comments on commit 4cb2711

Please sign in to comment.