Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry streams #63

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions dist/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 71 additions & 20 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions src/ids-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const ALLOWED_SUFFIXES = [
const DEFAULT_IDS_HOST = "https://install.determinate.systems";
const LOOKUP = process.env["IDS_LOOKUP"] ?? DEFAULT_LOOKUP;

const DEFAULT_TIMEOUT = 30_000; // 30 seconds in milliseconds
const DEFAULT_TIMEOUT = 10_000; // 10 seconds in ms

/**
* Host information for install.determinate.systems.
Expand All @@ -41,7 +41,11 @@ export class IdsHost {
}

async getGot(
recordFailoverCallback?: (prevUrl: URL, nextUrl: URL) => void,
recordFailoverCallback?: (
incitingError: unknown,
prevUrl: URL,
nextUrl: URL,
) => void,
): Promise<Got> {
if (this.client === undefined) {
this.client = got.extend({
Expand All @@ -50,7 +54,7 @@ export class IdsHost {
},

retry: {
limit: (await this.getUrlsByPreference()).length,
limit: Math.max((await this.getUrlsByPreference()).length, 3),
methods: ["GET", "HEAD"],
},

Expand All @@ -62,7 +66,7 @@ export class IdsHost {
const nextUrl = await this.getRootUrl();

if (recordFailoverCallback !== undefined) {
recordFailoverCallback(prevUrl, nextUrl);
recordFailoverCallback(error, prevUrl, nextUrl);
}

actionsCore.info(
Expand Down
Loading