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

fix: Adjust backoff settings to only retry 10 times and max out at 4 seconds per retry #84

Merged
merged 1 commit into from
Jul 31, 2024
Merged
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
19 changes: 14 additions & 5 deletions lib/setup-cloudflare-warp.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import * as fs from "fs";
import * as tc from "@actions/tool-cache";
import { backOff } from "exponential-backoff";

const backoffOptions = {
numOfAttempts: 10,
maxDelay: 4000,
};

async function installLinuxClient(version) {
const gpgKeyPath = await tc.downloadTool(
"https://pkg.cloudflareclient.com/pubkey.gpg",
Expand Down Expand Up @@ -153,11 +158,12 @@ export async function run() {
break;
}

await backOff(() => checkWARPRegistration(organization, true), {
numOfAttempts: 20,
});
await backOff(
() => checkWARPRegistration(organization, true),
backoffOptions,
);
await exec.exec("warp-cli", ["--accept-tos", "connect"]);
await backOff(() => checkWARPConnected(), { numOfAttempts: 20 });
await backOff(() => checkWARPConnected(), backoffOptions);
core.saveState("connected", "true");
}

Expand All @@ -176,6 +182,9 @@ export async function cleanup() {
const connected = !!core.getState("connected");
if (connected) {
const organization = core.getInput("organization", { required: true });
await backOff(() => checkWARPRegistration(organization, false));
await backOff(
() => checkWARPRegistration(organization, false),
backoffOptions,
);
}
}
Loading