aboutsummaryrefslogtreecommitdiff
path: root/src/scheduler.h
diff options
context:
space:
mode:
authorAmiti Uttarwar <amiti@uttarwar.org>2020-01-28 15:26:32 -0800
committerAmiti Uttarwar <amiti@uttarwar.org>2020-02-13 08:59:51 -0800
commita6f63598adb880a75e1571aac58338c17fa7ad53 (patch)
tree39e76485823c1cc23f734cf84f931cab7282b796 /src/scheduler.h
parentaabec94541e23a67a9f30dc2c80dab3383a01737 (diff)
[util] allow scheduler to be mocked
Add MockForward method to the scheduler that mimics going into the future by rescheduling all items on the taskQueue to be sooner.
Diffstat (limited to 'src/scheduler.h')
-rw-r--r--src/scheduler.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/scheduler.h b/src/scheduler.h
index 7080adf34c..d18be0ea5e 100644
--- a/src/scheduler.h
+++ b/src/scheduler.h
@@ -55,6 +55,13 @@ public:
// need more accurate scheduling, don't use this method.
void scheduleEvery(Function f, int64_t deltaMilliSeconds);
+ /**
+ * Mock the scheduler to fast forward in time.
+ * Iterates through items on taskQueue and reschedules them
+ * to be delta_seconds sooner.
+ */
+ void MockForward(boost::chrono::seconds delta_seconds);
+
// To keep things as simple as possible, there is no unschedule.
// Services the queue 'forever'. Should be run in a thread,