Skip to content

Commit df0a144

Browse files
f-ffsoikin
andauthored
It's always traverse
Co-authored-by: Fyodor Soikin <[email protected]>
1 parent cfc28f0 commit df0a144

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/Spago/Command/Fetch.purs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -218,15 +218,11 @@ fetchPackagesToLocalCache packages = do
218218
GitPackage gitPackage -> do
219219
-- for git repos it's a little more involved since cloning them takes a while and we risk race conditions
220220
-- and possibly cloning the same repo multiple times - so we use a lock on the git url to prevent that
221-
case Map.lookup gitPackage.git gitLocks of
222-
Nothing -> do
223-
-- This is not supposed to happen but we just move on if it does
224-
getGitPackageInLocalCache name gitPackage
225-
Just lock -> do
226-
-- Take the lock, do the git thing, release the lock
227-
liftAff $ AVar.take lock
228-
getGitPackageInLocalCache name gitPackage
229-
liftAff $ AVar.put unit lock
221+
let lock = Map.lookup gitPackage.git gitLocks
222+
-- Take the lock, do the git thing, release the lock
223+
liftAff $ AVar.take `traverse_` lock
224+
getGitPackageInLocalCache name gitPackage
225+
liftAff $ AVar.put unit `traverse_` lock
230226
RegistryVersion v -> do
231227
-- if the version comes from the registry then we have a longer list of things to do
232228
let versionString = Registry.Version.print v

0 commit comments

Comments
 (0)