mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
feat: filter proxy and display type
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user