From: Vsevolod Stakhov Date: Tue, 11 Jun 2019 11:17:38 +0000 (+0100) Subject: [Minor] Another try to fix transactions mess X-Git-Tag: 2.0~798 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f90b03d52fe3510275681cdda61106b5759414c2;p=rspamd.git [Minor] Another try to fix transactions mess --- diff --git a/src/libstat/backends/sqlite3_backend.c b/src/libstat/backends/sqlite3_backend.c index f4254c779..2a512db8b 100644 --- a/src/libstat/backends/sqlite3_backend.c +++ b/src/libstat/backends/sqlite3_backend.c @@ -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; }