summaryrefslogtreecommitdiff
path: root/cel
diff options
context:
space:
mode:
Diffstat (limited to 'cel')
-rw-r--r--cel/cel_sqlite3_custom.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/cel/cel_sqlite3_custom.c b/cel/cel_sqlite3_custom.c
index 6075b8a2b..5675da6b3 100644
--- a/cel/cel_sqlite3_custom.c
+++ b/cel/cel_sqlite3_custom.c
@@ -68,6 +68,7 @@ static char table[80];
* \bug Handling of this var is crash prone on reloads
*/
static char *columns;
+static int busy_timeout;
struct values {
char *expression;
@@ -187,6 +188,15 @@ static int load_config(int reload)
strcpy(table, "cel");
}
+ /* sqlite3_busy_timeout in miliseconds */
+ if ((tmp = ast_variable_retrieve(cfg, "master", "busy_timeout")) != NULL) {
+ if (ast_parse_arg(tmp, PARSE_INT32|PARSE_DEFAULT, &busy_timeout, 1000) != 0) {
+ ast_log(LOG_WARNING, "Invalid busy_timeout value '%s' specified. Using 1000 instead.\n", tmp);
+ }
+ } else {
+ busy_timeout = 1000;
+ }
+
/* Columns */
if (load_column_config(ast_variable_retrieve(cfg, "master", "columns"))) {
ast_config_destroy(cfg);
@@ -306,7 +316,7 @@ static int load_module(void)
free_config();
return AST_MODULE_LOAD_DECLINE;
}
- sqlite3_busy_timeout(db, 1000);
+ sqlite3_busy_timeout(db, busy_timeout);
/* is the table there? */
sql = sqlite3_mprintf("SELECT COUNT(*) FROM %q;", table);
res = sqlite3_exec(db, sql, NULL, NULL, NULL);