From de15460cb76953d0b8c149970adc510a0af495ac Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 8 Nov 2015 09:41:43 +0000 Subject: [PATCH] Rollback failed transaction. --- src/libserver/fuzzy_backend.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libserver/fuzzy_backend.c b/src/libserver/fuzzy_backend.c index 7ac492c36..fd1f9e4d0 100644 --- a/src/libserver/fuzzy_backend.c +++ b/src/libserver/fuzzy_backend.c @@ -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); } } } -- 2.39.5