Set Infinite Timeout for Periodic tasks
We don't expect the user of scheduler API to schedule a periodic tasks multiple times so it's safe to set the default timeout as infinite
Tested
UT
#tlbmc
PiperOrigin-RevId: 745187611
Change-Id: If62ce8dff2b31a1794f8f5257bfd7b41a68fc6a6
diff --git a/tlbmc/scheduler/scheduler.h b/tlbmc/scheduler/scheduler.h
index 008eb27..4a02172 100644
--- a/tlbmc/scheduler/scheduler.h
+++ b/tlbmc/scheduler/scheduler.h
@@ -126,10 +126,12 @@
//
// The `task` will be invoked with a `on_done` callback as a parameter.
// The `on_done` callback will be invoked when the task is done.
+ // The `timeout` parameter is the timeout for the task to complete. If not
+ // specified, the infinite timeout is used.
int RunAndScheduleAsync(
absl::AnyInvocable<void(absl::AnyInvocable<void()>)> task,
absl::Duration period,
- std::optional<absl::Duration> timeout = std::nullopt);
+ std::optional<absl::Duration> timeout = absl::InfiniteDuration());
// Schedule a oneshot task that is async.
int ScheduleOneShotAsync(