feat(DataProcessor): use constant for concurrency limit in pLimit calls

This commit is contained in:
DragonnZhang 2026-02-10 14:10:31 +08:00
parent dd56345ac6
commit e29aab478e
2 changed files with 6 additions and 10 deletions

View file

@ -45,6 +45,8 @@ import {
const logger = createDebugLogger('DataProcessor'); const logger = createDebugLogger('DataProcessor');
const CONCURRENCY_LIMIT = 2;
export class DataProcessor { export class DataProcessor {
constructor(private config: Config) {} constructor(private config: Config) {}
@ -565,7 +567,7 @@ export class DataProcessor {
], ],
}; };
const limit = pLimit(2); const limit = pLimit(CONCURRENCY_LIMIT);
try { try {
const [ const [
@ -969,7 +971,7 @@ None captured`;
logger.info(`Analyzing ${recentFiles.length} recent sessions with LLM...`); logger.info(`Analyzing ${recentFiles.length} recent sessions with LLM...`);
// Create a limit function with concurrency of 4 to avoid 429 errors // Create a limit function with concurrency of 4 to avoid 429 errors
const limit = pLimit(2); const limit = pLimit(CONCURRENCY_LIMIT);
let completed = 0; let completed = 0;
const total = recentFiles.length; const total = recentFiles.length;

View file

@ -187,15 +187,9 @@ export const useSlashCommandProcessor = (
progress: message.progress, progress: message.progress,
}; };
} else { } else {
// At this point message should be of type { type: INFO|ERROR|USER, content: string }
// We cast to be sure or check existence of content
const msg = message as {
type: MessageType.INFO | MessageType.ERROR | MessageType.USER;
content: string;
};
historyItemContent = { historyItemContent = {
type: msg.type, type: message.type,
text: msg.content, text: message.content,
}; };
} }
addItem(historyItemContent, message.timestamp.getTime()); addItem(historyItemContent, message.timestamp.getTime());