fix hhwheeltimertest
authorDave Watson <davejwatson@fb.com>
Fri, 29 Jul 2016 18:28:50 +0000 (11:28 -0700)
committerFacebook Github Bot 9 <facebook-github-bot-9-bot@fb.com>
Fri, 29 Jul 2016 18:38:38 +0000 (11:38 -0700)
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

index 026d94bba6f7b8ce9735f73f771c8440be6561b3..457cf8313bb0ccbc3a3d0f8499da7aa38eba6729 100644 (file)
@@ -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<std::chrono::milliseconds>(
         end.getTime() - start.getTime()).count() > 250) {