浏览代码

Fix transaction abort in Search\truncateIndex()

Visman 1 年之前
父节点
当前提交
48bcd118ad
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      app/Models/Search/TruncateIndex.php

+ 6 - 0
app/Models/Search/TruncateIndex.php

@@ -19,8 +19,14 @@ class TruncateIndex extends Method
      */
     public function truncateIndex(): void
     {
+        if ($this->c->DB->inTransaction()) {
+            $this->c->DB->commit();
+        }
+
         $this->c->DB->truncateTable('::search_cache');
         $this->c->DB->truncateTable('::search_matches');
         $this->c->DB->truncateTable('::search_words');
+
+        $this->c->DB->beginTransaction();
     }
 }