summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-08-15 10:26:26 +1000
committerjacqueline <me@jacqueline.id.au>2024-08-15 10:26:26 +1000
commit9c56261122a98245c8e6e7e9f1c94a8b683f8832 (patch)
treed29baebcf791ef8de5483f9dde6c9353a285db75 /src
parentd94c32d615e266de69f424261c46983ad10f9c70 (diff)
downloadtangara-fw-9c56261122a98245c8e6e7e9f1c94a8b683f8832.tar.gz
Delay DB reindexing slightly
This helps with boot time by preventing a ton of disk I/O before the UI has had a chance to load.
Diffstat (limited to 'src')
-rw-r--r--src/tangara/system_fsm/running.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/tangara/system_fsm/running.cpp b/src/tangara/system_fsm/running.cpp
index f9bca074..07166e2f 100644
--- a/src/tangara/system_fsm/running.cpp
+++ b/src/tangara/system_fsm/running.cpp
@@ -188,6 +188,10 @@ auto Running::mountStorage() -> void {
// mounted card.
if (sServices->nvs().DbAutoIndex()) {
sServices->bg_worker().Dispatch<void>([&]() {
+ // Delay the index update for a bit, since we don't want to cause a lot
+ // of disk contention immediately after mounting (especially when we've
+ // just booted), or else we risk slowing down stuff like UI loading.
+ vTaskDelay(pdMS_TO_TICKS(6000));
auto db = sServices->database().lock();
if (!db) {
return;