folly::FunctionScheduler: Adding capability to reset a function's timer
authorJimmy Saade <jimmyjs@fb.com>
Mon, 14 Mar 2016 12:07:14 +0000 (05:07 -0700)
committerFacebook Github Bot 7 <facebook-github-bot-7-bot@fb.com>
Mon, 14 Mar 2016 12:20:21 +0000 (05:20 -0700)
commit13c58db990deb957dc178b48cf77c0c9aeb3876d
tree6533be318e617701910068107db1f5187153b246
parent1c15b5bb9efd09201a956885e863fc8815c67b87
folly::FunctionScheduler: Adding capability to reset a function's timer

Summary:Adding support for resetting a specified function's timer.

"Resetting a function's timer" effectively means "canceling whatever next runs it would have had, and treating it as though it were just added".
When `resetFunctionTimer` is called, the specified function's interval (timer) will be reset, and it will execute after its initially-specified `startDelay`. If the `startDelay` is zero, the function will execute immediately, and then be scheduled as before - once every `interval` milliseconds.

Motivation: batch processing of updates, where both a size and time limit are in play. If the size limit is reached, it makes sense to reset the timer for the scheduled function.

Differential Revision: D3045868

fb-gh-sync-id: a5ceb0069c04a77fdab16b61679987ee55484e89
shipit-source-id: a5ceb0069c04a77fdab16b61679987ee55484e89
folly/experimental/FunctionScheduler.cpp
folly/experimental/FunctionScheduler.h
folly/experimental/test/FunctionSchedulerTest.cpp