]> jfr.im git - irc/atheme/atheme.git/commitdiff
modules/backend/corestorage: respect general::db_save_blocking
authorAaron Jones <redacted>
Sat, 19 Feb 2022 00:48:11 +0000 (00:48 +0000)
committerAaron Jones <redacted>
Sat, 19 Feb 2022 00:52:26 +0000 (00:52 +0000)
We're not just called from the periodic commit timer, but also
on rehash, which includes some modreloads too (when reloading a
module that has configuration options).

We should always use a blocking save regardless of what caused
the save to happen, rather than just test in the periodic commit
timer callback.

This makes running under Valgrind much more amenable.

Fixes: b427d04059d4d4f7b396
libathemecore/atheme.c
modules/backend/corestorage.c

index be81f0a5f258e49d914a7ae775f4705b1959f37f..d6a7d0b3186f236a8fc1afb390d84f497d847183 100644 (file)
@@ -381,10 +381,7 @@ db_save_periodic(void *unused)
 {
        slog(LG_DEBUG, "db_save_periodic(): initiating periodic database write");
 
-       if (config_options.db_save_blocking)
-               db_save(unused, DB_SAVE_BLOCKING);
-       else
-               db_save(unused, DB_SAVE_BG_REGULAR);
+       db_save(unused, DB_SAVE_BG_REGULAR);
 }
 
 int
index 6ca617105790304cfb3d4362aec3374f9352f6ea..5d3ce4eee2f940fb5acf1fc938a9b32353ebbd3f 100644 (file)
@@ -1088,7 +1088,6 @@ corestorage_db_write(void *filename, enum db_save_strategy strategy)
 #ifndef HAVE_FORK
        corestorage_db_write_blocking(filename);
 #else
-
        if (child_pid && strategy == DB_SAVE_BG_REGULAR)
        {
                slog(LG_DEBUG, "db_save(): previous save unfinished, skipping save");
@@ -1105,6 +1104,9 @@ corestorage_db_write(void *filename, enum db_save_strategy strategy)
                }
        }
 
+       if (config_options.db_save_blocking)
+               strategy = DB_SAVE_BLOCKING;
+
        if (strategy == DB_SAVE_BLOCKING)
        {
                corestorage_db_write_blocking(filename);