diff options
| author | levlam <levlam@telegram.org> | 2023-03-21 12:25:01 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2023-03-21 12:25:01 +0300 |
| commit | 52509b20a80cc401d7eaa06cf3902f82d57cc8dc (patch) | |
| tree | 07f9d079db0bf2470c23d25406f2af745e7bccf6 /tdactor/td/actor/MultiTimeout.cpp | |
| parent | cf9866cfe40b0c439a8d8cb772d9aa0143b813d9 (diff) | |
Improve check in MultiTimeout::update_timeout.
Diffstat (limited to 'tdactor/td/actor/MultiTimeout.cpp')
| -rw-r--r-- | tdactor/td/actor/MultiTimeout.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tdactor/td/actor/MultiTimeout.cpp b/tdactor/td/actor/MultiTimeout.cpp index 74cd6291d..56dedd461 100644 --- a/tdactor/td/actor/MultiTimeout.cpp +++ b/tdactor/td/actor/MultiTimeout.cpp @@ -69,8 +69,17 @@ void MultiTimeout::update_timeout(const char *source) { if (items_.empty()) { LOG(DEBUG) << "Cancel timeout of " << get_name(); LOG_CHECK(timeout_queue_.empty()) << get_name() << ' ' << source; - LOG_CHECK(Actor::has_timeout()) << get_name() << ' ' << source; - Actor::cancel_timeout(); + if (!Actor::has_timeout()) { + bool has_pending_timeout = false; + for (auto &event : get_info()->mailbox_) { + if (event.type == Event::Type::Timeout) { + has_pending_timeout = true; + } + } + LOG_CHECK(has_pending_timeout) << get_name() << ' ' << get_info()->mailbox_.size() << ' ' << source; + } else { + Actor::cancel_timeout(); + } } else { LOG(DEBUG) << "Set timeout of " << get_name() << " in " << timeout_queue_.top_key() - Time::now_cached(); Actor::set_timeout_at(timeout_queue_.top_key()); |
