Skip to content

Commit

Permalink
fix occasional empty transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
anthmFS committed Nov 20, 2012
1 parent 55ac6d2 commit ce885f1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/switch_core_sqldb.c
Expand Up @@ -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++) {
Expand All @@ -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);

Expand Down

0 comments on commit ce885f1

Please sign in to comment.