diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-09-14 20:44:58 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-09-14 20:44:58 -0400 |
commit | b6e4a09f1b60e80fe065fd21621902113a1bc9ea (patch) | |
tree | 57c120fa3ba3f8342fb57d3426e98ea23d7d57e4 /HTTP | |
parent | e26b363df51c61bb779563697c59304f78e55cdf (diff) | |
download | keysafe-b6e4a09f1b60e80fe065fd21621902113a1bc9ea.tar.gz |
rejigger to avoid division underflow
Diffstat (limited to 'HTTP')
-rw-r--r-- | HTTP/RateLimit.hs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/HTTP/RateLimit.hs b/HTTP/RateLimit.hs index 3a17a5a..591c918 100644 --- a/HTTP/RateLimit.hs +++ b/HTTP/RateLimit.hs @@ -399,7 +399,7 @@ checkRequestRate cfg storedir ratelimiter logger intervalsecs = do let storesize = maximum knownObjectSizes n <- liftIO $ atomically $ swapTMVar (requestCounter ratelimiter) 0 let maxstoredinterval = n * fromIntegral storesize - let maxstoredthismonth = maxstoredinterval * (intervalsecs `div` (60*60)) * 24 * 31 + let maxstoredthismonth = maxstoredinterval * (intervalsecs * 24*31 `div` (60*60)) freespace <- diskFree <$> localDiskUsage storedir let target = monthsToFillHalfDisk cfg let estimate = if maxstoredthismonth <= 0 |