LiveUpdate db updates working

I've tested the behavior of the thread that waits for the LiveUpdate to
be finished, and it does get signaled and exit cleanly when the
LiveUpdate is GCed instead.

Made finishedLiveUpdate wait for the thread to finish updating the
database.

There is a case where GC doesn't happen in time and the database is left
with a live update recorded in it. This should not be a problem as such
stale data can also happen when interrupted and will need to be detected
when loading the database.

Balanced preferred content expressions now call startLiveUpdate.
This commit is contained in:
Joey Hess 2024-08-24 11:49:58 -04:00
parent 84d1bb746b
commit 2f20b939b7
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 55 additions and 38 deletions

View file

@ -31,7 +31,7 @@ import Types.Messages
{- Parses input arguments, finds a matching Command, and runs it. -}
dispatch :: Bool -> Bool -> CmdParams -> [Command] -> [(String, String)] -> IO Git.Repo -> String -> String -> IO ()
dispatch addonok fuzzyok allargs allcmds fields getgitrepo progname progdesc =
dispatch addonok fuzzyok allargs allcmds fields getgitrepo progname progdesc = do
go addonok allcmds $
findAddonCommand subcommandname >>= \case
Just c -> go addonok (c:allcmds) noop