Skip to content

Commit

Permalink
remove dev code
Browse files Browse the repository at this point in the history
  • Loading branch information
toyamarinyon committed Oct 21, 2024
1 parent 3066e22 commit a988b16
Showing 1 changed file with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,6 @@ import {
webSearchStatus,
} from "./types";

async function limitConcurrency<T>(
tasks: (() => Promise<T>)[],
maxConcurrent: number,
): Promise<T[]> {
const results: T[] = [];
const runningTasks = new Set<Promise<void>>();

for (const task of tasks) {
if (runningTasks.size >= maxConcurrent) {
await Promise.race(runningTasks);
}

const runningTask = (async () => {
try {
results.push(await task());
} finally {
runningTasks.delete(runningTask);
}
})();

runningTasks.add(runningTask);
}

await Promise.all(runningTasks);
return results;
}

interface GenerateWebSearchStreamInputs {
userPrompt: string;
systemPrompt?: string;
Expand Down

0 comments on commit a988b16

Please sign in to comment.