Skip to content

Commit fa93c3f

Browse files
Merge pull request #149 from Sebastian-Webster/147-option-downloadretries-is-off-by-1
Fix off by one error with downloadRetries
2 parents 47e095a + a93dd90 commit fa93c3f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libraries/Downloader.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export function downloadBinary(binaryInfo: BinaryInfo, options: InternalServerOp
245245
logger.error('An error occurred while deleting extractedPath and/or archivePath:', e)
246246
}
247247

248-
if (downloadTries >= options.downloadRetries) {
248+
if (downloadTries > options.downloadRetries) {
249249
//Only reject if we have met the downloadRetries limit
250250
try {
251251
await releaseFunction()
@@ -258,7 +258,7 @@ export function downloadBinary(binaryInfo: BinaryInfo, options: InternalServerOp
258258
console.warn(`An error was encountered during the binary download process. Retrying for retry ${downloadTries}/${options.downloadRetries}. The error was:`, e)
259259
}
260260
}
261-
} while (downloadTries < options.downloadRetries)
261+
} while (downloadTries <= options.downloadRetries)
262262

263263
try {
264264
releaseFunction()
@@ -292,14 +292,14 @@ export function downloadBinary(binaryInfo: BinaryInfo, options: InternalServerOp
292292
logger.error('An error occurred while deleting extractedPath and/or archivePath:', e)
293293
}
294294

295-
if (downloadTries >= options.downloadRetries) {
295+
if (downloadTries > options.downloadRetries) {
296296
//Only reject if we have met the downloadRetries limit
297297
return reject(e)
298298
} else {
299299
console.warn(`An error was encountered during the binary download process. Retrying for retry ${downloadTries}/${options.downloadRetries}. The error was:`, e)
300300
}
301301
}
302-
} while (downloadTries < options.downloadRetries)
302+
} while (downloadTries <= options.downloadRetries)
303303
}
304304
})
305305
}

0 commit comments

Comments
 (0)