TQueue: now more than MAX_QUEUE_EVENTS events in each queue
GitOrigin-RevId: a8553f02f631fd34ef1451044c3ad7e27ee7d3dd
This commit is contained in:
parent
8226c9ab49
commit
3976bbb4c8
@ -100,8 +100,11 @@ class TQueueImpl : public TQueue {
|
||||
q.events.push(std::move(raw_event));
|
||||
}
|
||||
|
||||
EventId push(QueueId queue_id, string data, double expire_at, EventId new_id = EventId()) override {
|
||||
Result<EventId> push(QueueId queue_id, string data, double expire_at, EventId new_id = EventId()) override {
|
||||
auto &q = queues_[queue_id];
|
||||
if (q.events.size() >= MAX_QUEUE_EVENTS) {
|
||||
return Status::Error("Queue is full");
|
||||
}
|
||||
EventId event_id;
|
||||
while (true) {
|
||||
if (q.tail_id.empty()) {
|
||||
|
@ -65,7 +65,7 @@ class TQueue {
|
||||
|
||||
virtual void do_push(QueueId queue_id, RawEvent &&raw_event) = 0;
|
||||
|
||||
virtual EventId push(QueueId queue_id, string data, double expire_at, EventId new_id = EventId()) = 0;
|
||||
virtual Result<EventId> push(QueueId queue_id, string data, double expire_at, EventId new_id = EventId()) = 0;
|
||||
|
||||
virtual EventId get_head(QueueId queue_id) const = 0;
|
||||
virtual EventId get_tail(QueueId queue_id) const = 0;
|
||||
|
@ -85,9 +85,9 @@ class TestTQueue {
|
||||
|
||||
TQueue::EventId push(TQueue::QueueId queue_id, string data, double expire_at,
|
||||
TQueue::EventId new_id = TQueue::EventId()) {
|
||||
auto a_id = baseline_->push(queue_id, data, expire_at, new_id);
|
||||
auto b_id = memory_->push(queue_id, data, expire_at, new_id);
|
||||
auto c_id = binlog_->push(queue_id, data, expire_at, new_id);
|
||||
auto a_id = baseline_->push(queue_id, data, expire_at, new_id).move_as_ok();
|
||||
auto b_id = memory_->push(queue_id, data, expire_at, new_id).move_as_ok();
|
||||
auto c_id = binlog_->push(queue_id, data, expire_at, new_id).move_as_ok();
|
||||
ASSERT_EQ(a_id, b_id);
|
||||
ASSERT_EQ(a_id, c_id);
|
||||
return a_id;
|
||||
|
Loading…
Reference in New Issue
Block a user