Fix server can not stop with Ctrl + C

This commit is contained in:
2023-05-25 12:06:12 +08:00
parent 614f05fc22
commit 800e8b9603
4 changed files with 27 additions and 1 deletions

View File

@@ -43,6 +43,9 @@ export class TaskManager {
get aborted() {
return this.#abort.signal.aborted;
}
get aborts() {
return this.#abort.signal;
}
async add_download_task(gid: number, token: string) {
this.#check_closed();
const otask = await this.db.check_download_task(gid, token);
@@ -125,6 +128,9 @@ export class TaskManager {
get force_aborted() {
return this.#force_abort.signal.aborted;
}
get force_aborts() {
return this.#force_abort.signal;
}
async run() {
if (this.aborted || this.force_aborted) throw new AlreadyClosedError();
this.#check_closed();