summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-02-01 11:22:26 +1100
committerjacqueline <me@jacqueline.id.au>2024-02-01 11:22:26 +1100
commit2626c0cffc23c22382ef72aeafecdc107f7ea92c (patch)
treef430e746fee646dd136641c20c23aaa827b4831f
parentc8bbd4d52c4ab6c9fcd93915cb3fe23fb63e8279 (diff)
downloadtangara-fw-2626c0cffc23c22382ef72aeafecdc107f7ea92c.tar.gz
Do a db update after every mount
-rw-r--r--src/system_fsm/running.cpp11
1 files changed, 11 insertions, 0 deletions
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::Database>{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<void>([&]() {
+ auto db = sServices->database().lock();
+ if (!db) {
+ return;
+ }
+ db->updateIndexes();
+ });
+
return true;
}