Remove duplicative generic actor repeatEvery() since recurring() exists.

This commit is contained in:
Steve Atherton 2022-03-30 16:41:14 -07:00
parent d6e2d2a1fe
commit 84f9e00258
2 changed files with 2 additions and 10 deletions

View File

@ -10370,7 +10370,7 @@ TEST_CASE(":/redwood/performance/set") {
state Future<Void> stats =
traceMetrics ? Void()
: repeatEvery(1.0, [&]() { printf("Stats:\n%s\n", g_redwoodMetrics.toString(true).c_str()); });
: recurring([&]() { printf("Stats:\n%s\n", g_redwoodMetrics.toString(true).c_str()); }, 1.0);
if (scans > 0) {
printf("Parallel scans, concurrency=%d, scans=%d, scanWidth=%d, scanPreftchBytes=%d ...\n",

View File

@ -221,6 +221,7 @@ Future<T> delayed(Future<T> what, double time = 0.0, TaskPriority taskID = TaskP
}
}
// wait <interval> then call what() in a loop forever
ACTOR template <class Func>
Future<Void> recurring(Func what, double interval, TaskPriority taskID = TaskPriority::DefaultDelay) {
loop choose {
@ -2048,15 +2049,6 @@ private:
Reference<UnsafeWeakFutureReferenceData> data;
};
// Call a lambda every <interval> seconds
ACTOR template <typename Fn>
Future<Void> repeatEvery(double interval, Fn fn) {
loop {
wait(delay(interval));
fn();
}
}
#include "flow/unactorcompiler.h"
#endif