[Freeswitch-svn] [commit] r6505 - freeswitch/trunk/src
Freeswitch SVN
anthm at freeswitch.org
Tue Dec 4 18:03:05 EST 2007
Author: anthm
Date: Tue Dec 4 18:03:05 2007
New Revision: 6505
Modified:
freeswitch/trunk/src/switch_core_db.c
Log:
add retry on lock to core sql func
Modified: freeswitch/trunk/src/switch_core_db.c
==============================================================================
--- freeswitch/trunk/src/switch_core_db.c (original)
+++ freeswitch/trunk/src/switch_core_db.c Tue Dec 4 18:03:05 2007
@@ -79,7 +79,22 @@
SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db, const char *sql, switch_core_db_callback_func_t callback, void *data, char **errmsg)
{
- return sqlite3_exec(db, sql, callback, data, errmsg);
+ int ret;
+ int sane = 100;
+
+ while(--sane > 0) {
+ ret = sqlite3_exec(db, sql, callback, data, errmsg);
+
+ if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) {
+ switch_safe_free(*errmsg);
+ switch_yield(1000);
+ continue;
+ } else {
+ break;
+ }
+ }
+
+ return ret;
}
SWITCH_DECLARE(int) switch_core_db_finalize(switch_core_db_stmt_t *pStmt)
More information about the Freeswitch-svn
mailing list