clear fetch pool when click cancel
This commit is contained in:
@@ -4,6 +4,7 @@ import { taskPool } from "./pool";
|
||||
import {
|
||||
MSG_FETCH,
|
||||
MSG_FETCH_LIMIT,
|
||||
MSG_FETCH_CLEAR,
|
||||
CACHE_NAME,
|
||||
OPT_TRANS_MICROSOFT,
|
||||
OPT_TRANS_OPENAI,
|
||||
@@ -188,3 +189,17 @@ export const fetchUpdate = async (interval, limit) => {
|
||||
fetchPool.update(interval, limit);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 清空任务池
|
||||
*/
|
||||
export const fetchClear = async () => {
|
||||
if (isExt) {
|
||||
const res = await sendMsg(MSG_FETCH_CLEAR);
|
||||
if (res.error) {
|
||||
throw new Error(res.error);
|
||||
}
|
||||
} else {
|
||||
fetchPool.clear();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user