Browse Source

fix: don't crash if file is not found

C4illin 5 tháng trước cách đây
mục cha
commit
16f27c13bb
1 tập tin đã thay đổi với 8 bổ sung2 xóa
  1. 8 2
      src/index.tsx

+ 8 - 2
src/index.tsx

@@ -1420,8 +1420,14 @@ const clearJobs = () => {
 
   for (const job of jobs) {
     // delete the directories
-    rmSync(`${outputDir}${job.user_id}/${job.id}`, { recursive: true });
-    rmSync(`${uploadsDir}${job.user_id}/${job.id}`, { recursive: true });
+    rmSync(`${outputDir}${job.user_id}/${job.id}`, {
+      recursive: true,
+      force: true,
+    });
+    rmSync(`${uploadsDir}${job.user_id}/${job.id}`, {
+      recursive: true,
+      force: true,
+    });
 
     // delete the job
     db.query("DELETE FROM jobs WHERE id = ?").run(job.id);