From dd6e6b6877d4d063408202d0543a491c4dcba8b9 Mon Sep 17 00:00:00 2001 From: Dave Watson Date: Fri, 29 Jul 2016 11:28:50 -0700 Subject: [PATCH] fix hhwheeltimertest Summary: Test doesn't match comments. Remove extranous commented code. I think there was actually a subtle bug in the test: since 25 doesn't evenly divide in to 6, we could end up farther away than we were expecting. The same is true of 10/3, but it remains within the threshold. Reviewed By: yfeldblum Differential Revision: D3637078 fbshipit-source-id: d9881143c33c9b4f203f839e2e5106183301b530 --- folly/io/async/test/HHWheelTimerTest.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/folly/io/async/test/HHWheelTimerTest.cpp b/folly/io/async/test/HHWheelTimerTest.cpp index 026d94bb..457cf831 100644 --- a/folly/io/async/test/HHWheelTimerTest.cpp +++ b/folly/io/async/test/HHWheelTimerTest.cpp @@ -259,8 +259,8 @@ TEST_F(HHWheelTimerTest, AtMostEveryN) { // Create a timeout set with a 10ms interval, to fire no more than once // every 3ms. - milliseconds interval(25); - milliseconds atMostEveryN(6); + milliseconds interval(10); + milliseconds atMostEveryN(3); StackWheelTimer t(&eventBase, atMostEveryN); t.setCatchupEveryN(70); @@ -294,14 +294,11 @@ TEST_F(HHWheelTimerTest, AtMostEveryN) { ++index; }; - // Go ahead and schedule the first timeout now. - //scheduler.fn(); - TimePoint start; eventBase.loop(); TimePoint end; - // This should take roughly 2*60 + 25 ms to finish. If it takes more than + // This should take roughly 60 + 10 ms to finish. If it takes more than // 250 ms to finish the system is probably heavily loaded, so skip. if (std::chrono::duration_cast( end.getTime() - start.getTime()).count() > 250) { -- 2.34.1