add Annex worker pool to P2PHttp
This will be needed for get and store, since those need to run Annex actions. withLocalP2PConnections will also probably use it.
This commit is contained in:
parent
d4b9aea87b
commit
f9b7ce7224
7 changed files with 97 additions and 23 deletions
|
@ -97,13 +97,11 @@ changeStageTo mytid tv getnewstage = liftIO $
|
|||
|
||||
-- | Waits until there's an idle StartStage worker in the worker pool,
|
||||
-- removes it from the pool, and returns its state.
|
||||
--
|
||||
-- If the worker pool is not already allocated, returns Nothing.
|
||||
waitStartWorkerSlot :: TMVar (WorkerPool t) -> STM (Maybe (t, WorkerStage))
|
||||
waitStartWorkerSlot :: TMVar (WorkerPool t) -> STM (t, WorkerStage)
|
||||
waitStartWorkerSlot tv = do
|
||||
pool <- takeTMVar tv
|
||||
v <- go pool
|
||||
return $ Just (v, StartStage)
|
||||
return (v, StartStage)
|
||||
where
|
||||
go pool = case spareVals pool of
|
||||
[] -> retry
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue