fix task running state

This commit is contained in:
2021-04-20 12:01:10 +08:00
parent e0b0a5e986
commit 108ebb835f

View File

@ -111,7 +111,18 @@ export class Task {
if (upstreamData) {
urls = parseUrls(upstreamData);
} else {
urls = [await queryUrl(tab)];
let tabURL: string;
await queryUrl(tab)
.then(u => {
tabURL = u;
})
.catch(() => {
e => {
this._running = false;
return Promise.reject(e);
}
});
urls = [tabURL];
}
}
return urls.reduce((p, url, i) => p.then(
@ -134,8 +145,8 @@ export class Task {
if (results && results.length) {
let lastURL = urls[urls.length - 1];
this.saveResult(results, lastURL);
this._running = false;
}
this._running = false;
}
).catch(
e => {