flyer image fixin
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m27s

This commit is contained in:
2025-12-04 08:53:13 -08:00
parent 9a1b3bda8f
commit 2f64e348fc
3 changed files with 16 additions and 16 deletions

View File

@@ -200,20 +200,20 @@ export const flyerWorker = new Worker<FlyerJobData>(
} finally {
// This block will run after the try/catch, regardless of success or failure.
if (jobSucceeded) {
logger.info(`[Worker] Job ${job.id} succeeded. Cleaning up temporary files.`);
try {
// Delete the generated JPEG images from the PDF conversion.
for (const imagePath of createdImagePaths) {
await fs.unlink(imagePath);
logger.debug(`[Worker] Deleted temporary image: ${imagePath}`);
}
// Finally, delete the original uploaded file (PDF or image).
await fs.unlink(filePath);
logger.debug(`[Worker] Deleted original upload: ${filePath}`);
} catch (cleanupError) {
logger.error(`[Worker] Job ${job.id} completed, but failed during file cleanup.`, { error: cleanupError });
// We don't re-throw here because the main job was successful.
}
logger.info(`[Worker] Job ${job.id} succeeded. File cleanup is disabled; original files will be kept.`);
// try {
// // Delete the generated JPEG images from the PDF conversion.
// for (const imagePath of createdImagePaths) {
// await fs.unlink(imagePath);
// logger.debug(`[Worker] Deleted temporary image: ${imagePath}`);
// }
// // Finally, delete the original uploaded file (PDF or image).
// await fs.unlink(filePath);
// logger.debug(`[Worker] Deleted original upload: ${filePath}`);
// } catch (cleanupError) {
// logger.error(`[Worker] Job ${job.id} completed, but failed during file cleanup.`, { error: cleanupError });
// // We don't re-throw here because the main job was successful.
// }
} else {
logger.warn(`[Worker] Job ${job.id} failed. Temporary files will not be cleaned up to allow for manual inspection.`);
}