aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core.j2.c6
-rwxr-xr-xsalis.py5
2 files changed, 9 insertions, 2 deletions
diff --git a/core.j2.c b/core.j2.c
index ec158dc..8aeff5d 100644
--- a/core.j2.c
+++ b/core.j2.c
@@ -602,6 +602,9 @@ void salis_init() {
sqlite3_open("{{ data_push_path }}", &g_sim_data);
assert(g_sim_data);
+ // Install busy handler to retry transactions if DB is locked
+ sqlite3_busy_timeout(g_sim_data, {{ data_push_busy_timeout }});
+
arch_push_data_header();
arch_push_data_line();
{% endif %}
@@ -673,6 +676,9 @@ void salis_load() {
{% if data_push_path is defined %}
sqlite3_open("{{ data_push_path }}", &g_sim_data);
assert(g_sim_data);
+
+ // Install busy handler to retry transactions if DB is locked
+ sqlite3_busy_timeout(g_sim_data, {{ data_push_busy_timeout }});
{% endif %}
}
{% endif %}
diff --git a/salis.py b/salis.py
index 15e2351..a3281b5 100755
--- a/salis.py
+++ b/salis.py
@@ -245,8 +245,9 @@ if args.command in ["load", "new"]:
auto_save_name_len = f"{len(sim_path) + 20}"
if args.data_push_pow != 0:
- data_push_path = f"{sim_dir}/{args.name}.sqlite3"
- data_push_interval = ul_pow(args.data_push_pow)
+ data_push_path = f"{sim_dir}/{args.name}.sqlite3"
+ data_push_interval = ul_pow(args.data_push_pow)
+ data_push_busy_timeout = 600000
includes.append("sqlite3.h")
log("Data will be aggregated at:", data_push_path)
else: