Skip to content

Commit 330de85

Browse files
Merge pull request #253 from Sebastian-Webster/252-lock-does-not-get-released-when-getting-binary-download-redirect-url-on-alpine-linux
Fix lock not being released on binary URL redirect fetch failure that happened on Alpine Linux
2 parents d7d568c + 6d1cb47 commit 330de85

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libraries/Downloader.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,10 @@ export function downloadBinary(binaryInfo: BinaryInfo, options: InternalServerOp
293293
let useDownloadsURL = false;
294294

295295
do {
296-
const downloadURL = binaryInfo.hostedByOracle ? `${useDownloadsURL ? MySQLCDNDownloadsBaseURL : MySQLCDNArchivesBaseURL}${url}` : await getFileDownloadURLRedirect(url)
296+
let downloadURL: string = 'UNINITIALISED'
297297
try {
298298
downloadTries++;
299+
downloadURL = binaryInfo.hostedByOracle ? `${useDownloadsURL ? MySQLCDNDownloadsBaseURL : MySQLCDNArchivesBaseURL}${url}` : await getFileDownloadURLRedirect(url)
299300
logger.log(`Starting download for MySQL version ${version} from ${downloadURL}.`)
300301
await downloadFromCDN(downloadURL, archivePath, logger)
301302
logger.log(`Finished downloading MySQL version ${version} from ${downloadURL}. Now starting binary extraction.`)
@@ -358,14 +359,15 @@ export function downloadBinary(binaryInfo: BinaryInfo, options: InternalServerOp
358359
let useDownloadsURL = false;
359360

360361
do {
361-
const downloadURL = binaryInfo.hostedByOracle ? `${useDownloadsURL ? MySQLCDNDownloadsBaseURL : MySQLCDNArchivesBaseURL}${url}` : await getFileDownloadURLRedirect(url)
362+
let downloadURL: string = 'UNINITIALISED'
362363
const uuid = randomUUID()
363364
const zipFilepath = `${dirpath}/${uuid}.${fileExtension}`
364365
logger.log('Binary filepath:', zipFilepath)
365366
const extractedPath = `${dirpath}/${uuid}`
366367

367368
try {
368369
downloadTries++
370+
downloadURL = binaryInfo.hostedByOracle ? `${useDownloadsURL ? MySQLCDNDownloadsBaseURL : MySQLCDNArchivesBaseURL}${url}` : await getFileDownloadURLRedirect(url)
369371
logger.log(`Starting download for MySQL version ${version} from ${downloadURL}.`)
370372
await downloadFromCDN(downloadURL, zipFilepath, logger)
371373
logger.log(`Finished downloading MySQL version ${version} from ${downloadURL}. Now starting binary extraction.`)

0 commit comments

Comments
 (0)