Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed timer specs

  • Loading branch information...
commit 5b181817434ee077362b91481af584e1f3306c23 1 parent 40d2e2b
Nick Kallen authored
2  finagle-core/src/main/scala/com/twitter/finagle/util/Timer.scala
View
@@ -14,7 +14,7 @@ class Timer(underlying: org.jboss.netty.util.Timer) extends com.twitter.util.Tim
def run(to: Timeout) {
if (!to.isCancelled) f
}
- }, when.inMilliseconds, TimeUnit.MILLISECONDS)
+ }, (when - Time.now).inMilliseconds, TimeUnit.MILLISECONDS)
toTimerTask(timeout)
}
6 finagle-core/src/test/scala/com/twitter/finagle/util/TimerSpec.scala
View
@@ -19,13 +19,13 @@ object TimerSpec extends Specification with Mockito {
}
"not execute the task until it has timed out" in {
- latch.await(1.second) must beTrue
+ latch.await(2.seconds) must beTrue
(end - start).moreOrLessEquals(1.second, 10.milliseconds)
}
"not execute the task if it has been cancelled" in {
task.cancel()
- latch.await(1.second) must beFalse
+ latch.await(2.seconds) must beFalse
}
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.