From: Vsevolod Stakhov Date: Sun, 8 Nov 2015 09:41:43 +0000 (+0000) Subject: Rollback failed transaction. X-Git-Tag: 1.1.0~608 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=de15460cb76953d0b8c149970adc510a0af495ac;p=rspamd.git Rollback failed transaction. --- 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); } } }