aboutsummaryrefslogtreecommitdiff
path: root/Command/Unused.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-09-12 12:26:12 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-09-12 12:26:12 -0400
commit3afcb1a449ecfee52419767957fa1f06673515b6 (patch)
treef727f5b1ffe24b1a6769ee38336e2e08e8ab23ab /Command/Unused.hs
parent006e5e7fea3925cd1f4c650cf42b020520742d70 (diff)
Rather than crashing when there's a problem with the requested bloomfilter capacity/accuracy, fall back to a reasonable default bloom filter size.
Diffstat (limited to 'Command/Unused.hs')
-rw-r--r--Command/Unused.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/Command/Unused.hs b/Command/Unused.hs
index bf98e53bc..c2179447d 100644
--- a/Command/Unused.hs
+++ b/Command/Unused.hs
@@ -189,7 +189,12 @@ bloomBitsHashes :: Annex (Int, Int)
bloomBitsHashes = do
capacity <- bloomCapacity
accuracy <- bloomAccuracy
- return $ suggestSizing capacity (1/ fromIntegral accuracy)
+ case safeSuggestSizing capacity (1 / fromIntegral accuracy) of
+ Left e -> do
+ warning $ "bloomfilter " ++ e ++ "; falling back to sane value"
+ -- precaulculated value for 500000 (1/1000)
+ return (8388608,10)
+ Right v -> return v
{- Creates a bloom filter, and runs an action, such as withKeysReferenced,
- to populate it.