From ce885f1c31a60eafe61969513280ad587fde6eca Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 20 Nov 2012 13:45:32 -0600 Subject: [PATCH] fix occasional empty transaction --- src/switch_core_sqldb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 5df382efab..f396d18f2b 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1670,7 +1670,7 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread, while (qm->thread_running == 1) { uint32_t i, lc; - uint32_t written, iterations = 0; + uint32_t written = 0, iterations = 0; if (sql_manager.paused) { for (i = 0; i < qm->numq; i++) { @@ -1680,7 +1680,10 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread, } do { - written = do_trans(qm); + if (!qm_ttl(qm)) { + goto check; + } + written = do_trans(qm); iterations += written; } while(written == qm->max_trans);