diff --git a/include/dpp/cluster.h b/include/dpp/cluster.h index cc4465bd59..352a200f54 100644 --- a/include/dpp/cluster.h +++ b/include/dpp/cluster.h @@ -363,7 +363,7 @@ class DPP_EXPORT cluster { * @param seconds How long to wait for * @return awaitable Object that can be co_await-ed to suspend the function for a certain time */ - awaitable co_sleep(uint64_t seconds); + [[nodiscard]] awaitable co_sleep(uint64_t seconds); #endif /** diff --git a/src/dpp/cluster/timer.cpp b/src/dpp/cluster/timer.cpp index 3f92d61e52..af767fff5a 100644 --- a/src/dpp/cluster/timer.cpp +++ b/src/dpp/cluster/timer.cpp @@ -106,8 +106,8 @@ void cluster::tick_timers() { #ifdef DPP_CORO awaitable cluster::co_sleep(uint64_t seconds) { - return {[this, seconds] (auto &&cb) { - start_timer([this, cb](dpp::timer handle) { + return awaitable{[this, seconds] (auto &&cb) mutable { + start_timer([this, cb] (dpp::timer handle) { cb(handle); stop_timer(handle); }, seconds);