SPDX-License-Identifier: AGPL-3.0-only

Associate each worker action with its own completion signal and cancellation
flag so shutdown can claim and join delivery, notification and XFTP workers
exactly once before their shared SQLite store is closed.

Index: src/Simplex/Messaging/Agent/Env/SQLite.hs
--- src/Simplex/Messaging/Agent/Env/SQLite.hs.orig
+++ src/Simplex/Messaging/Agent/Env/SQLite.hs
@@ -323,7 +323,8 @@
 data Worker = Worker
   { workerId :: Int,
     doWork :: TMVar (),
-    action :: TMVar (Maybe (Weak ThreadId)),
+    action :: TMVar (Maybe (Weak ThreadId, TMVar ())),
+    cancelled :: TVar Bool,
     restarts :: TVar RestartCount
   }
 
