move remoteList into dupState
This does mean that RemoteDaemon.Transport.Tor's call runs it, otherwise no change, but this is groundwork for doing more such expensive actions in dupState.
This commit is contained in:
parent
988317634b
commit
fe9cf1256e
7 changed files with 148 additions and 20 deletions
|
@ -10,11 +10,9 @@ module Annex.Concurrent where
|
|||
import Annex
|
||||
import Annex.Common
|
||||
import qualified Annex.Queue
|
||||
import Annex.CatFile
|
||||
import Annex.CheckAttr
|
||||
import Annex.HashObject
|
||||
import Annex.CheckIgnore
|
||||
import Annex.Action
|
||||
import Types.WorkerPool
|
||||
import Remote.List
|
||||
|
||||
import Control.Concurrent
|
||||
import Control.Concurrent.STM
|
||||
|
@ -46,6 +44,11 @@ forkState a = do
|
|||
-}
|
||||
dupState :: Annex AnnexState
|
||||
dupState = do
|
||||
-- Make sure that some expensive actions have been done before
|
||||
-- starting threads. This way the state has them already run,
|
||||
-- and each thread won't try to do them.
|
||||
_ <- remoteList
|
||||
|
||||
st <- Annex.getState id
|
||||
return $ st
|
||||
-- each thread has its own repoqueue
|
||||
|
@ -66,14 +69,6 @@ mergeState st = do
|
|||
Annex.Queue.mergeFrom st'
|
||||
changeState $ \s -> s { errcounter = errcounter s + errcounter st' }
|
||||
|
||||
{- Stops all long-running git query processes. -}
|
||||
stopCoProcesses :: Annex ()
|
||||
stopCoProcesses = do
|
||||
catFileStop
|
||||
checkAttrStop
|
||||
hashObjectStop
|
||||
checkIgnoreStop
|
||||
|
||||
{- Runs an action and makes the current thread have the specified stage
|
||||
- while doing so. If too many other threads are running in the specified
|
||||
- stage, waits for one of them to become idle.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue