Skip to content

Commit

Permalink
Don't run speedtest if current one is valid (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego Rodríguez Baquero authored Jul 19, 2023
1 parent c262a44 commit 57010ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/static-code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@ jobs:
contents: read
security-events: write

strategy:
fail-fast: true

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
Expand Down
7 changes: 5 additions & 2 deletions container/shim/src/modules/registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ export async function register(initial = false) {

verifyHWRequirements(requirements, stats);

let preregisterResponse;
if (initial) {
await sendPreRegisterRequest(postOptions({ nodeId: NODE_ID }));
preregisterResponse = await sendPreRegisterRequest(postOptions({ nodeId: NODE_ID }));
}

if (VERSION !== DEV_VERSION && initial) {
if (VERSION !== DEV_VERSION && initial && preregisterResponse?.speedtestRequired !== false) {
let speedtest;
try {
speedtest = await getSpeedtest();
Expand Down Expand Up @@ -257,6 +258,8 @@ async function sendPreRegisterRequest(postOptions) {
}

debug("Successful pre-registration");

return await res.json();
} catch (err) {
debug("Failed pre-registration: %s", err.message);
// we don't try again if we fail the pre-registration
Expand Down

0 comments on commit 57010ca

Please sign in to comment.