fix Annex.repoSize sharing between threads

This commit is contained in:
Joey Hess 2024-08-16 10:56:51 -04:00
parent e361b9ea3c
commit 61d95627f3
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 56 additions and 46 deletions

View file

@ -132,6 +132,7 @@ data AnnexRead = AnnexRead
, forcenumcopies :: Maybe NumCopies
, forcemincopies :: Maybe MinCopies
, forcebackend :: Maybe String
, reposizes :: MVar (Maybe (M.Map UUID RepoSize))
, rebalance :: Bool
, useragent :: Maybe String
, desktopnotify :: DesktopNotify
@ -149,6 +150,7 @@ newAnnexRead c = do
tp <- newTransferrerPool
cm <- newTMVarIO M.empty
cc <- newTMVarIO (CredentialCache M.empty)
rs <- newMVar Nothing
return $ AnnexRead
{ branchstate = bs
, activekeys = emptyactivekeys
@ -166,6 +168,7 @@ newAnnexRead c = do
, forcebackend = Nothing
, forcenumcopies = Nothing
, forcemincopies = Nothing
, reposizes = rs
, rebalance = False
, useragent = Nothing
, desktopnotify = mempty
@ -202,7 +205,6 @@ data AnnexState = AnnexState
, remoteconfigmap :: Maybe (M.Map UUID RemoteConfig)
, clusters :: Maybe (Annex Clusters)
, maxsizes :: Maybe (M.Map UUID MaxSize)
, reposizes :: Maybe (M.Map UUID RepoSize)
, forcetrust :: TrustMap
, trustmap :: Maybe TrustMap
, groupmap :: Maybe GroupMap
@ -258,7 +260,6 @@ newAnnexState c r = do
, remoteconfigmap = Nothing
, clusters = Nothing
, maxsizes = Nothing
, reposizes = Nothing
, forcetrust = M.empty
, trustmap = Nothing
, groupmap = Nothing