Add analysis pipeline

This commit is contained in:
dahyeon committed 2026-07-02 20:40:49 -07:00
1 parent 256d776131
commit 770c198ccd
20 files changed
+2572 -1

No files matched your search

@@ -0,0 +1,18 @@
export const ANALYSIS_QUEUE_NAME = 'analysis';
export const USER_ANALYSIS_JOB_NAME = 'user-analysis';
export const ANALYSIS_JOB_ID_FACTORY = Symbol('ANALYSIS_JOB_ID_FACTORY');
export const DEFAULT_ANALYSIS_MATCH_COUNT = 20;
export const MAX_ANALYSIS_MATCH_COUNT = 50;
export const ACTIVE_ANALYSIS_JOB_STATUSES = ['queued', 'processing'] as const;
export function normalizeRequestedMatchCount(
requestedMatchCount: number,
): number {
if (!Number.isFinite(requestedMatchCount) || requestedMatchCount <= 0) {
return DEFAULT_ANALYSIS_MATCH_COUNT;
}
return Math.min(Math.trunc(requestedMatchCount), MAX_ANALYSIS_MATCH_COUNT);
}