MCPcopy
hub / github.com/SYJun404/frank / splitRequests

Function splitRequests

src/lcu/aboutMatch.ts:15–34  ·  view source on GitHub ↗
(puuid: string, begIndex: number, endIndex: number)

Source from the content-addressed store, hash-verified

13
14// 辅助函数:拆分请求区间
15const splitRequests = async (puuid: string, begIndex: number, endIndex: number): Promise<Games[]> => {
16 const step = 10; // 每段的范围为 10
17 let allGames: Games[] = [];
18 let currentBegIndex = begIndex;
19
20 // 循环拆分请求
21 while (currentBegIndex < endIndex) {
22 const currentEndIndex = Math.min(currentBegIndex + step - 1, endIndex);
23 const games = await fetchMatchHistory(puuid, currentBegIndex, currentEndIndex);
24
25 if (games.length > 0) {
26 allGames = allGames.concat(games);
27 }
28
29 currentBegIndex = currentEndIndex + 1;
30 await delay(200);
31 }
32
33 return allGames;
34};
35
36// 主函数:查询历史比赛数据
37export const queryMatchHistory = async (puuid: string, begIndex: number, endIndex: number): Promise<Games[] | null> => {

Callers 1

queryMatchHistoryFunction · 0.85

Calls 2

fetchMatchHistoryFunction · 0.85
delayFunction · 0.85

Tested by

no test coverage detected