moar unit test !
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 6m9s

This commit is contained in:
2025-12-07 01:26:17 -08:00
parent 08e73c4ca1
commit 6d5cafda38
8 changed files with 348 additions and 7 deletions

View File

@@ -96,12 +96,11 @@ interface CleanupJobData {
}
/**
* The main worker process for handling flyer jobs.
* This should be run as a separate process.
* Processor function for the flyer-processing queue.
* This is exported for testability.
* @param job The job to process.
*/
export const flyerWorker = new Worker<FlyerJobData>(
'flyer-processing',
async (job: Job<FlyerJobData>) => {
export const flyerWorkerProcessor = async (job: Job<FlyerJobData>) => {
const { filePath, originalFileName, checksum, userId, submitterIp, userProfileAddress } = job.data;
const createdImagePaths: string[] = [];
let jobSucceeded = false;
@@ -226,7 +225,11 @@ export const flyerWorker = new Worker<FlyerJobData>(
logger.warn(`[Worker] Job ${job.id} failed. Temporary files will not be cleaned up to allow for manual inspection.`);
}
}
},
};
export const flyerWorker = new Worker<FlyerJobData>(
'flyer-processing',
flyerWorkerProcessor,
{
connection,
// Control the number of concurrent jobs. This directly limits parallel calls to the AI API.