mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-28 17:41:54 +08:00
Refactor: speed up reject parsing
This commit is contained in:
@@ -16,10 +16,10 @@ const latestTopUserAgentsPromise = fetchWithRetry('https://unpkg.com/top-user-ag
|
||||
.then(res => res.json() as Promise<string[]>);
|
||||
|
||||
const querySpeedtestApi = async (keyword: string): Promise<Array<string | null>> => {
|
||||
const [topUserAgents] = await Promise.all([
|
||||
const topUserAgents = (await Promise.all([
|
||||
latestTopUserAgentsPromise,
|
||||
s.acquire()
|
||||
]);
|
||||
]))[0];
|
||||
|
||||
const randomUserAgent = topUserAgents[Math.floor(Math.random() * topUserAgents.length)];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user