Skip to content

Commit

Permalink
Give release archive workflows more time
Browse files Browse the repository at this point in the history
  • Loading branch information
Will committed Oct 8, 2024
1 parent 8d1d39d commit d48c27c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/domain/release-archive.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios, { AxiosResponse } from "axios";
import axios, { AxiosError, AxiosResponse } from "axios";
import axiosRetry from "axios-retry";
import extractZip from "extract-zip";
import fs from "node:fs";
Expand Down Expand Up @@ -108,6 +108,13 @@ export class ReleaseArchive {
}
}

function exponentialDelay(retryCount: number, error: AxiosError): number {
// Using exponential backoff with 3 retries and a delay factor of 10 seconds
// gives you at least 70 seconds to publish a release archive.
const tenSeconds = 10000;
return axiosRetry.exponentialDelay(retryCount, error, tenSeconds);
}

async function download(url: string, dest: string): Promise<void> {
if (process.env.INTEGRATION_TESTING) {
// Point downloads to the standin github server
Expand All @@ -127,7 +134,7 @@ async function download(url: string, dest: string): Promise<void> {
// Retry the request in case the artifact is still being uploaded
axiosRetry(axios, {
retries: 3,
retryDelay: axiosRetry.exponentialDelay,
retryDelay: exponentialDelay,
});

let response: AxiosResponse;
Expand Down

0 comments on commit d48c27c

Please sign in to comment.