From bd730c82b0423af65f7148bb4abe01e1c3430691 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Sat, 9 Dec 2023 10:24:35 +1100 Subject: [PATCH] Do db updates on the bg worker --- src/app_console/app_console.cpp | 4 +++- src/ui/ui_fsm.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app_console/app_console.cpp b/src/app_console/app_console.cpp index b5698792..63accc21 100644 --- a/src/app_console/app_console.cpp +++ b/src/app_console/app_console.cpp @@ -161,7 +161,9 @@ int CmdDbInit(int argc, char** argv) { std::cout << "no database open" << std::endl; return 1; } - db->updateIndexes(); + + AppConsole::sServices->bg_worker().Dispatch( + [=]() { db->updateIndexes(); }); return 0; } diff --git a/src/ui/ui_fsm.cpp b/src/ui/ui_fsm.cpp index f4b56a27..4a196f5d 100644 --- a/src/ui/ui_fsm.cpp +++ b/src/ui/ui_fsm.cpp @@ -399,7 +399,7 @@ void Indexing::entry() { // TODO: Hmm. return; } - db->updateIndexes(); + sServices->bg_worker().Dispatch([=]() { db->updateIndexes(); }); } void Indexing::exit() {