simpler way to do this
Remove old code that can be trivially implemented using async in a much nicer way (that is async exception safe). I've audited all forkOS calls (except for ones in the assistant), and this was the last remaining one that is not async exception safe. The rest look ok to me.
This commit is contained in:
parent
074260f036
commit
660d8d3a87
3 changed files with 7 additions and 37 deletions
|
@ -17,7 +17,6 @@ import Assistant.DaemonStatus
|
|||
import Assistant.ScanRemotes
|
||||
import Assistant.RemoteControl
|
||||
import qualified Command.Sync
|
||||
import Utility.Parallel
|
||||
import qualified Git
|
||||
import qualified Git.Command
|
||||
import qualified Remote
|
||||
|
@ -43,6 +42,7 @@ import Database.Export
|
|||
import Data.Time.Clock
|
||||
import qualified Data.Map as M
|
||||
import Control.Concurrent
|
||||
import Control.Concurrent.Async
|
||||
|
||||
{- Syncs with remotes that may have been disconnected for a while.
|
||||
-
|
||||
|
@ -177,6 +177,11 @@ parallelPush g rs a = do
|
|||
<*> (Remote.getRepo r >>= \repo ->
|
||||
sshOptionsTo repo (Remote.gitconfig r) g)
|
||||
|
||||
inParallel :: (v -> IO Bool) -> [v] -> IO ([v], [v])
|
||||
inParallel a l = (\(t,f) -> (map fst t, map fst f))
|
||||
. partition snd
|
||||
. zip l <$> mapConcurrently a l
|
||||
|
||||
{- Displays an alert while running an action that syncs with some remotes,
|
||||
- and returns any remotes that it failed to sync with.
|
||||
-
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue