Skip to content

Commit

Permalink
Update main.d
Browse files Browse the repository at this point in the history
* Wait for all parallel jobs that depend on the database to complete - added from f86c4b9
  • Loading branch information
abraunegg committed Oct 24, 2023
1 parent 9837e59 commit b9f20cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down

0 comments on commit b9f20cd

Please sign in to comment.