mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-05 07:27:35 +08:00
fix infinite loop occur in while - length of promise don't change
This commit is contained in:
+15
-7
@@ -1,5 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog v-bind="$attrs" @open="handleDialogOpen">
|
<el-dialog
|
||||||
|
v-bind="$attrs"
|
||||||
|
@open="handleDialogOpen"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:close-on-press-escape="false"
|
||||||
|
:show-close="false"
|
||||||
|
>
|
||||||
<template v-if="!copiedDependenciesStatus.puppeteerExecutableAvailable">
|
<template v-if="!copiedDependenciesStatus.puppeteerExecutableAvailable">
|
||||||
<div>Downloading Dedicate Browser</div>
|
<div>Downloading Dedicate Browser</div>
|
||||||
<el-progress :percentage="browserDownloadPercentage" :format="(n) => `${n.toFixed(1)}%`" />
|
<el-progress :percentage="browserDownloadPercentage" :format="(n) => `${n.toFixed(1)}%`" />
|
||||||
@@ -57,17 +63,20 @@ const processTasks = async () => {
|
|||||||
promiseList.push(p)
|
promiseList.push(p)
|
||||||
p.then(() => {
|
p.then(() => {
|
||||||
copiedDependenciesStatus.puppeteerExecutableAvailable = true
|
copiedDependenciesStatus.puppeteerExecutableAvailable = true
|
||||||
}).finally(() => {
|
|
||||||
const idx = promiseList.indexOf(p)
|
|
||||||
idx >= 0 && promiseList.splice(idx, 1)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
while (promiseList.length) {
|
while (promiseList.length) {
|
||||||
|
const p = promiseList.shift()!
|
||||||
try {
|
try {
|
||||||
await promiseList[0]
|
p.then(() => {
|
||||||
|
if (!promiseList.length) {
|
||||||
|
props.dispose?.()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
await p
|
||||||
} catch {
|
} catch {
|
||||||
ElMessageBox.confirm('Encounter error while setup dependencies. Retry?')
|
await ElMessageBox.confirm('Encounter error while setup dependencies. Retry?')
|
||||||
.then(() => {
|
.then(() => {
|
||||||
processTasks()
|
processTasks()
|
||||||
})
|
})
|
||||||
@@ -78,7 +87,6 @@ const processTasks = async () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
props.dispose?.()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processTasks()
|
processTasks()
|
||||||
|
|||||||
Reference in New Issue
Block a user