Erase the dummy event when new event is pushed to TQueue.
GitOrigin-RevId: 42f310f52cf74ddf32655fe3da42c731ff24e799
This commit is contained in:
parent
7d8d13606c
commit
7187b9c32f
@ -110,6 +110,17 @@ class TQueueImpl : public TQueue {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!q.events.empty()) {
|
||||||
|
auto it = q.events.end();
|
||||||
|
--it;
|
||||||
|
if (it->second.data.empty()) {
|
||||||
|
if (callback_ != nullptr && it->second.logevent_id != 0) {
|
||||||
|
callback_->pop(it->second.logevent_id);
|
||||||
|
}
|
||||||
|
q.events.erase(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (raw_event.logevent_id == 0 && callback_ != nullptr) {
|
if (raw_event.logevent_id == 0 && callback_ != nullptr) {
|
||||||
raw_event.logevent_id = callback_->push(queue_id, raw_event);
|
raw_event.logevent_id = callback_->push(queue_id, raw_event);
|
||||||
}
|
}
|
||||||
@ -279,7 +290,6 @@ class TQueueImpl : public TQueue {
|
|||||||
void pop(Queue &q, QueueId queue_id, std::map<EventId, RawEvent>::iterator &it, EventId tail_id) {
|
void pop(Queue &q, QueueId queue_id, std::map<EventId, RawEvent>::iterator &it, EventId tail_id) {
|
||||||
auto &event = it->second;
|
auto &event = it->second;
|
||||||
if (callback_ == nullptr || event.logevent_id == 0) {
|
if (callback_ == nullptr || event.logevent_id == 0) {
|
||||||
event.logevent_id = 0;
|
|
||||||
remove_event(q, it);
|
remove_event(q, it);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -292,7 +302,6 @@ class TQueueImpl : public TQueue {
|
|||||||
++it;
|
++it;
|
||||||
} else {
|
} else {
|
||||||
callback_->pop(event.logevent_id);
|
callback_->pop(event.logevent_id);
|
||||||
event.logevent_id = 0;
|
|
||||||
remove_event(q, it);
|
remove_event(q, it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user