Browse Source

Fix transaction abort in Search\truncateIndex()

Visman 1 year ago
parent
commit
48bcd118ad
1 changed files with 6 additions and 0 deletions
  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();
     }
 }