flyer image fixin
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m27s
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m27s
This commit is contained in:
@@ -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.`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user