feat: filter proxy and display type

This commit is contained in:
GyDi
2022-02-27 00:58:14 +08:00
parent 24e6c1ea36
commit 40fc2b78d3
5 changed files with 269 additions and 45 deletions

View File

@@ -32,6 +32,39 @@ class DelayManager {
this.setDelay(name, group, delay);
return delay;
}
async checkListDelay(
options: {
names: readonly string[];
groupName: string;
skipNum: number;
maxTimeout: number;
},
callback: Function
) {
let names = [...options.names];
const { groupName, skipNum, maxTimeout } = options;
while (names.length) {
const list = names.slice(0, skipNum);
names = names.slice(skipNum);
let called = false;
setTimeout(() => {
if (!called) {
called = true;
callback();
}
}, maxTimeout);
await Promise.all(list.map((n) => this.checkDelay(n, groupName)));
if (!called) {
called = true;
callback();
}
}
}
}
export default new DelayManager();