diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-11 12:17:38 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-11 12:17:38 +0100 |
commit | f90b03d52fe3510275681cdda61106b5759414c2 (patch) | |
tree | bdc47a9a5bf6f41bee0fdb6b1bc08d4ac2cfae77 /src | |
parent | cef345bf0592c06e18154d9696f71324f11e9fd4 (diff) | |
download | rspamd-f90b03d52fe3510275681cdda61106b5759414c2.tar.gz rspamd-f90b03d52fe3510275681cdda61106b5759414c2.zip |
[Minor] Another try to fix transactions mess
Diffstat (limited to 'src')
-rw-r--r-- | src/libstat/backends/sqlite3_backend.c | 25 |
1 files changed, 3 insertions, 22 deletions
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; } |