]> source.dussan.org Git - rspamd.git/commitdiff
Rollback failed transaction.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 8 Nov 2015 09:41:43 +0000 (09:41 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 8 Nov 2015 09:41:43 +0000 (09:41 +0000)
src/libserver/fuzzy_backend.c

index 7ac492c36ead7d0559df60481ed90e3b89afe5bb..fd1f9e4d0e68fbbb7871c46d07b461af165d52f3 100644 (file)
@@ -758,6 +758,11 @@ rspamd_fuzzy_backend_sync (struct rspamd_fuzzy_backend *backend,
 
                                ret = rspamd_fuzzy_backend_run_stmt (backend,
                                                RSPAMD_FUZZY_BACKEND_TRANSACTION_COMMIT);
+
+                               if (ret != SQLITE_OK) {
+                                       rspamd_fuzzy_backend_run_stmt (backend,
+                                                       RSPAMD_FUZZY_BACKEND_TRANSACTION_ROLLBACK);
+                               }
                        }
                        if (ret != SQLITE_OK) {
                                msg_warn_fuzzy_backend ("cannot expire db: %s",
@@ -819,7 +824,8 @@ rspamd_fuzzy_backend_sync (struct rspamd_fuzzy_backend *backend,
                                                msg_warn_fuzzy_backend (
                                                                "cannot synchronize fuzzy backend: %e",
                                                                err);
-                                               g_error_free (err);
+                                               rspamd_fuzzy_backend_run_stmt (backend,
+                                                               RSPAMD_FUZZY_BACKEND_TRANSACTION_ROLLBACK);
                                        }
                                }
                        }