Fix scheduling bug
authorDave Watson <davejwatson@fb.com>
Wed, 10 Aug 2016 22:41:29 +0000 (15:41 -0700)
committerFacebook Github Bot 7 <facebook-github-bot-7-bot@fb.com>
Wed, 10 Aug 2016 22:53:38 +0000 (15:53 -0700)
commit09a84b282cc6d0d5498877eb16e50bc7f5c9869f
tree67400d612fd158887370500977928e90796cc7b4
parent28c41287ec1006bac2a465b0244deb1f00607bc0
Fix scheduling bug

Summary:
Noticed this while debugging other timerwheel changes.  Scheduling new events in callbacks may result in us *running them right away* if they land in a bucket we are currently processing.

Instead, round up all the timeouts, then run them separately.  This means you can never schedule a timeout that will run immediately (0ticks), but that's probably fine.

Reviewed By: yfeldblum

Differential Revision: D3679413

fbshipit-source-id: 7e18632f23ea33c072c2718e30b378641895b094
folly/io/async/HHWheelTimer.cpp
folly/io/async/HHWheelTimer.h
folly/io/async/test/HHWheelTimerTest.cpp