mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-08-12 09:59:05 +08:00
fix: wait-for-selector stalling process
This commit is contained in:
parent
da1098f38d
commit
7bc70a1955
@ -1210,7 +1210,6 @@ export class PuppeteerControl extends AsyncService {
|
|||||||
}
|
}
|
||||||
await Promise.race([Promise.allSettled([...pageScriptEvaluations, ...frameScriptEvaluations]), delayPromise])
|
await Promise.race([Promise.allSettled([...pageScriptEvaluations, ...frameScriptEvaluations]), delayPromise])
|
||||||
.catch(() => void 0);
|
.catch(() => void 0);
|
||||||
finalizationPromise = doFinalization();
|
|
||||||
return stuff;
|
return stuff;
|
||||||
});
|
});
|
||||||
if (options.waitForSelector) {
|
if (options.waitForSelector) {
|
||||||
@ -1232,16 +1231,16 @@ export class PuppeteerControl extends AsyncService {
|
|||||||
});
|
});
|
||||||
return p as any;
|
return p as any;
|
||||||
});
|
});
|
||||||
|
finalizationPromise = Promise.allSettled([waitForPromise, gotoPromise]).then(doFinalization);
|
||||||
|
} else {
|
||||||
|
finalizationPromise = gotoPromise.then(doFinalization);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let lastHTML = snapshot?.html;
|
let lastHTML = snapshot?.html;
|
||||||
while (true) {
|
while (true) {
|
||||||
const ckpt = [nextSnapshotDeferred.promise, gotoPromise];
|
const ckpt = [nextSnapshotDeferred.promise, waitForPromise ?? gotoPromise];
|
||||||
if (waitForPromise) {
|
|
||||||
ckpt.push(waitForPromise);
|
|
||||||
}
|
|
||||||
if (options.minIntervalMs) {
|
if (options.minIntervalMs) {
|
||||||
ckpt.push(delay(options.minIntervalMs));
|
ckpt.push(delay(options.minIntervalMs));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user