Fix MutliTimeout bug
GitOrigin-RevId: 7c30c7232b2462d0ad232c71bf66b7af97a9fe38
This commit is contained in:
parent
b40df8c118
commit
e671318c99
@ -82,11 +82,15 @@ void MultiTimeout::timeout_expired() {
|
||||
while (!timeout_queue_.empty() && timeout_queue_.top_key() < now) {
|
||||
int64 key = static_cast<Item *>(timeout_queue_.pop())->key;
|
||||
items_.erase(Item(key));
|
||||
callback_(data_, key);
|
||||
expired_.push_back(key);
|
||||
}
|
||||
if (!items_.empty()) {
|
||||
update_timeout();
|
||||
}
|
||||
for (auto key : expired_) {
|
||||
callback_(data_, key);
|
||||
}
|
||||
expired_.clear();
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -117,6 +117,7 @@ class MultiTimeout final : public Actor {
|
||||
|
||||
KHeap<double> timeout_queue_;
|
||||
std::set<Item> items_;
|
||||
std::vector<int64> expired_;
|
||||
|
||||
void update_timeout();
|
||||
|
||||
|
Reference in New Issue
Block a user