From 2626c0cffc23c22382ef72aeafecdc107f7ea92c Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 1 Feb 2024 11:22:26 +1100 Subject: [PATCH] Do a db update after every mount --- src/system_fsm/running.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/system_fsm/running.cpp b/src/system_fsm/running.cpp index 14c5f28b..ec146029 100644 --- a/src/system_fsm/running.cpp +++ b/src/system_fsm/running.cpp @@ -142,6 +142,17 @@ auto Running::mountStorage() -> bool { std::unique_ptr{database_res.value()}); ESP_LOGI(kTag, "storage loaded okay"); + + // Tell the database to refresh so that we pick up any changes from the newly + // mounted card. + sServices->bg_worker().Dispatch([&]() { + auto db = sServices->database().lock(); + if (!db) { + return; + } + db->updateIndexes(); + }); + return true; }