summaryrefslogtreecommitdiff
path: root/Backend
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-25 21:15:29 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-25 21:15:29 -0400
commit68e2687661cdc83197e78fd56a10803890401159 (patch)
tree28540b5cdbd3e0cf33e5ae797c4abd95c21a8c74 /Backend
parenteea140c90dadfc8cc5ac4aec65c9d710f859c310 (diff)
short-circuit as soon as enough remotes are verified to have a file
Diffstat (limited to 'Backend')
-rw-r--r--Backend/File.hs13
1 files changed, 8 insertions, 5 deletions
diff --git a/Backend/File.hs b/Backend/File.hs
index 4b7d7917c..4273ba36b 100644
--- a/Backend/File.hs
+++ b/Backend/File.hs
@@ -111,11 +111,14 @@ checkRemoveKey key = do
then return True
else notEnoughCopies need have bad
findcopies need have (r:rs) bad = do
- haskey <- Remotes.inAnnex r key
- case (haskey) of
- Right True -> findcopies need (have+1) rs bad
- Right False -> findcopies need have rs bad
- Left _ -> findcopies need have rs (r:bad)
+ if (have >= need)
+ then return True
+ else do
+ haskey <- Remotes.inAnnex r key
+ case (haskey) of
+ Right True -> findcopies need (have+1) rs bad
+ Right False -> findcopies need have rs bad
+ Left _ -> findcopies need have rs (r:bad)
notEnoughCopies need have bad = do
unsafe
showLongNote $