MCPcopy Create free account
hub / github.com/msgbyte/tailchat / submitQueue

Function submitQueue

client/shared/utils/request.ts:23–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21 let timer: number | null = null;
22
23 async function submitQueue() {
24 timer = null; // 清空计时器以接受后续请求
25 const _queue = [...queue];
26 queue = []; // 清空队列
27
28 try {
29 const list = await fn(_queue.map((q) => q.params));
30 _queue.forEach((q1, i) => {
31 q1.resolve(list[i]);
32 });
33 } catch (err) {
34 _queue.forEach((q2) => {
35 q2.reject(err);
36 });
37 }
38 }
39
40 return (params: T): Promise<R> => {
41 if (!timer) {

Callers 1

createAutoMergedRequestFunction · 0.85

Calls 1

fnFunction · 0.50

Tested by

no test coverage detected