19 lines
640 B
TypeScript
19 lines
640 B
TypeScript
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);
|
|
}
|