Skip to content

Commit

Permalink
fix: Adjust backoff settings to only retry 10 times and max out at 4 …
Browse files Browse the repository at this point in the history
…seconds per retry
  • Loading branch information
marcusramberg authored and F21 committed Jul 31, 2024
1 parent 9074e80 commit 67afa43
Showing 1 changed file with 14 additions and 5 deletions.
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,
);
}
}

0 comments on commit 67afa43

Please sign in to comment.