]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Another try to fix transactions mess
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 11 Jun 2019 11:17:38 +0000 (12:17 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 11 Jun 2019 11:17:38 +0000 (12:17 +0100)
src/libstat/backends/sqlite3_backend.c

index f4254c779ba58ed64cf7aaadfd37feb8774d15f3..2a512db8be87ec0cfac050d83a9e60cb9481de90 100644 (file)
@@ -485,29 +485,10 @@ rspamd_sqlite3_opendb (rspamd_mempool_t *pool,
        }
 
        /* Check tokenizer configuration */
-
-       while ((ret = rspamd_sqlite3_run_prstmt (pool, bk->sqlite, bk->prstmt,
-                       RSPAMD_STAT_BACKEND_TRANSACTION_START_IM)) == SQLITE_BUSY &&
-                       ++ntries <= max_tries) {
-               nanosleep (&sleep_ts, NULL);
-       }
-
-       if (ret != SQLITE_OK) {
-               msg_err_pool ("failed to start transaction: %d, %s", ret,
-                               sqlite3_errmsg (bk->sqlite));
-               sqlite3_close (bk->sqlite);
-               g_free (bk);
-
-               return NULL;
-       }
-
        if (rspamd_sqlite3_run_prstmt (pool, bk->sqlite, bk->prstmt,
                        RSPAMD_STAT_BACKEND_LOAD_TOKENIZER, &sz64, &tk_conf) != SQLITE_OK ||
                        sz64 == 0) {
 
-               rspamd_sqlite3_run_prstmt (pool, bk->sqlite, bk->prstmt,
-                               RSPAMD_STAT_BACKEND_TRANSACTION_COMMIT);
-
                while ((ret = rspamd_sqlite3_run_prstmt (pool, bk->sqlite, bk->prstmt,
                                RSPAMD_STAT_BACKEND_TRANSACTION_START_EXCL)) == SQLITE_BUSY &&
                           ++ntries <= max_tries) {
@@ -534,15 +515,15 @@ rspamd_sqlite3_opendb (rspamd_mempool_t *pool,
 
                        return NULL;
                }
+
+               rspamd_sqlite3_run_prstmt (pool, bk->sqlite, bk->prstmt,
+                               RSPAMD_STAT_BACKEND_TRANSACTION_COMMIT);
                g_free (tok_conf_encoded);
        }
        else {
                g_free (tk_conf);
        }
 
-       rspamd_sqlite3_run_prstmt (pool, bk->sqlite, bk->prstmt,
-                               RSPAMD_STAT_BACKEND_TRANSACTION_COMMIT);
-
        return bk;
 }