From b9f20cd357cc337c3ffda92bc962acb95b0bcfa6 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Wed, 25 Oct 2023 08:36:16 +1100 Subject: [PATCH] Update main.d * Wait for all parallel jobs that depend on the database to complete - added from https://github.com/abraunegg/onedrive/pull/2523/commits/f86c4b9d9ecec2e8b312664fddc6ca7fb0b887fc --- src/main.d | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.d b/src/main.d index cc81d3b7..87616733 100644 --- a/src/main.d +++ b/src/main.d @@ -1139,12 +1139,14 @@ extern(C) nothrow @nogc @system void exitHandler(int value) { try { assumeNoGC ( () { log.log("Got termination signal, performing clean up"); - // was itemDb initialised? + // Wait for all parallel jobs that depend on the database to complete + taskPool.finish(true); + // Was itemDb initialised? if (itemDB.isDatabaseInitialised()) { // Make sure the .wal file is incorporated into the main db before we exit log.log("Shutting down DB connection and merging temporary data"); itemDB.performVacuum(); - destroy(itemDB); + object.destroy(itemDB); } })(); } catch(Exception e) {}