Adjust backoffThreshold in ResizerSpec, see #2763

* When it failed the backoff calculation was often based on
  pressure=1 and capacity=4, 1/4=0.25 which is greater than
  the backoffThreshold=0.2, i.e no backoff was done.
* Changed backoffThreshold to 0.4.
* Avoid sleep inside the target actor when cool down
This commit is contained in:
Patrik Nordwall 2012-12-05 09:32:10 +01:00
parent 86a85f8605
commit d2ce939db4

View file

@ -180,13 +180,14 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with
upperBound = 5,
rampupRate = 1.0,
backoffRate = 1.0,
backoffThreshold = 0.20,
backoffThreshold = 0.40,
pressureThreshold = 1,
messagesPerResize = 1)
val router = system.actorOf(Props(new Actor {
def receive = {
case n: Int Thread.sleep((n millis).dilated.toMillis)
case n: Int if n <= 0 // done
case n: Int Thread.sleep((n millis).dilated.toMillis)
}
}).withRouter(RoundRobinRouter(resizer = Some(resizer))))
@ -203,7 +204,7 @@ class ResizerSpec extends AkkaSpec(ResizerSpec.config) with DefaultTimeout with
// let it cool down
awaitCond({
router ! 1 // trigger resize
router ! 0 // trigger resize
routeeSize(router) < z
}, interval = 500.millis.dilated)