Skip to content

Commit 19a854d

Browse files
committed
UPD | 1.0.3 release #5
1 parent 1fa08c0 commit 19a854d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/ManapiTimerPool.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,14 @@ int64_t manapi::timerpool::calculate_repeat_(const std::shared_ptr<data_t> &data
292292

293293
bool manapi::timerpool::reinit_timer_(const std::shared_ptr<data_t> &data_) MANAPIHTTP_NOEXCEPT {
294294
if (data_->timer) {
295+
data_->timer->stop();
296+
295297
auto delay = calculate_repeat_(data_);
296298
//manapi_log_trace(manapi::debug::LOG_TRACE_LOW, "reinit_timer:delay=%llu now=%llu", delay, std::chrono::steady_clock::now().time_since_epoch());
297-
if (!delay) {
298-
delay = 1;
299-
}
300299

301-
if (delay > 0) {
300+
if (delay >= 0) {
302301
if (data_->timer->is_active()) {
303-
data_->timer->repeat(delay);
302+
data_->timer->start(delay, 1);
304303
if (data_->timer->again()) {
305304
manapi_log_error("set the timerpool again failed");
306305
return false;
@@ -310,9 +309,6 @@ bool manapi::timerpool::reinit_timer_(const std::shared_ptr<data_t> &data_) MANA
310309
data_->timer->start(delay, 1);
311310
}
312311
}
313-
else {
314-
data_->timer->stop();
315-
}
316312
}
317313

318314
return true;

0 commit comments

Comments
 (0)