Skip to content

Commit a763002

Browse files
authored
[event] suppress expected optimizer drop warnings
1 parent 47af2fc commit a763002

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

kv_cache_manager/event/optimizer_event_publisher.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ bool OptimizerEventPublisher::Publish(const std::shared_ptr<BaseEvent> &event) {
3636
return false;
3737
}
3838
// Runs on a serving thread: enqueue and return, nothing else. A full queue
39-
// drops the event (counted by the base class) rather than blocking.
40-
return BasicEnqueue(event);
39+
// drops the event (counted by the base class) without surfacing an expected
40+
// best-effort drop as a publish failure and triggering a warning per request.
41+
BasicEnqueue(event);
42+
return true;
4143
}
4244

4345
bool OptimizerEventPublisher::Stop() {

kv_cache_manager/event/test/optimizer_event_publisher_test.cc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,9 @@ TEST_F(OptimizerEventPublisherTest, TestSinkRefusalIsNotCountedAsForwarded) {
201201
EXPECT_EQ(0u, publisher_->ForwardedCount());
202202
}
203203

204-
// The queue is the boundary that protects serving threads: it must refuse, not
205-
// grow and not block.
204+
// The queue is the boundary that protects serving threads: it must drop, not
205+
// grow and not block. Expected best-effort drops are handled without surfacing
206+
// a publisher failure to EventManager.
206207
TEST_F(OptimizerEventPublisherTest, TestFullQueueDropsInsteadOfBlocking) {
207208
sink_->set_accept(false);
208209
const auto config = MakePublisherConfig(4);
@@ -211,13 +212,9 @@ TEST_F(OptimizerEventPublisherTest, TestFullQueueDropsInsteadOfBlocking) {
211212
publisher->InitBasicQueue(config.queue_size());
212213
publisher->running_ = true;
213214

214-
int accepted = 0;
215215
for (int i = 0; i < 50; ++i) {
216-
if (publisher->Publish(MakeGetEvent("instance-a", {i}, {1}))) {
217-
++accepted;
218-
}
216+
EXPECT_TRUE(publisher->Publish(MakeGetEvent("instance-a", {i}, {1})));
219217
}
220-
EXPECT_EQ(4, accepted);
221218
EXPECT_EQ(46u, publisher->DroppedCount());
222219
publisher->running_ = false;
223220
}

0 commit comments

Comments
 (0)