فهرست منبع

fix: import worker error handling

nonvioce 3 ماه پیش
والد
کامیت
aaa736c1d1
1فایلهای تغییر یافته به همراه8 افزوده شده و 2 حذف شده
  1. 8 2
      tiku-server/app/routers/import_.py

+ 8 - 2
tiku-server/app/routers/import_.py

@@ -32,8 +32,14 @@ def _import_worker():
         task_id, tmp_path, import_type, source_name, config = task
         try:
             _process_import(task_id, tmp_path, import_type, source_name, config)
-        except Exception:
-            pass
+        except Exception as e:
+            conn = get_connection(config.db_path)
+            try:
+                update_import_task(conn, task_id, status="error", message=str(e))
+            except Exception:
+                pass
+            finally:
+                conn.close()
         _import_queue.task_done()
 
 # 启动后台工作线程