BUGFIX: incorrect OOBGC algorithm, not dynamically adjusting

This commit is contained in:
Sam 2014-04-02 12:26:59 +11:00
parent bd7d1e62f6
commit 024b86e112

View file

@ -106,12 +106,12 @@ module Middleware::UnicornOobgc
@max_delta ||= delta @max_delta ||= delta
if delta > @max_delta if delta > @max_delta
new_delta = (delta * 1.5).to_i new_delta = (@max_delta * 1.5).to_i
@max_delta = [new_delta, delta].min @max_delta = [new_delta, delta].min
else else
# this may seem like a very tiny decay rate, but some apps using caching # this may seem like a very tiny decay rate, but some apps using caching
# can really mess stuff up, if our delta is too low the algorithm fails # can really mess stuff up, if our delta is too low the algorithm fails
new_delta = (delta * 0.995).to_i new_delta = (@max_delta * 0.99).to_i
@max_delta = [new_delta, delta].max @max_delta = [new_delta, delta].max
end end