Skip to content

Commit 33e1581

Browse files
committed
Polish test comment
Signed-off-by: Daniel Garnier-Moiroux <git@garnier.wf>
1 parent 14fd7ed commit 33e1581

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎mcp-test/src/test/java/io/modelcontextprotocol/modern/server/SubscriptionsFeatureTests.java‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,10 @@ void changeBroadcastAsSoonAsAckIsDeliveredReachesTheStream() {
291291
McpChangeFeed feed = new McpChangeFeed();
292292
McpServer server = toolsServer(feed);
293293

294-
// Trigger a change from the subscribing thread the change is broadcast right when
295-
// ack is received.
296-
// This simulates high CPU loads in test harnesses, were writing the ack might
297-
// happen
298-
// sooner than any subsequent event subscription.
294+
// Broadcast a change synchronously from inside the ack's onNext, on the
295+
// thread delivering the ack. This is the earliest moment a test harness
296+
// reacting to the ack can broadcast a change, so the stream must already
297+
// be subscribed to the feed by the time the ack is emitted.
299298
Flux<JSONRPCMessage> messages = listen(server, 1).messages().doOnNext(msg -> {
300299
if (msg instanceof JSONRPCNotification notification
301300
&& notification.method().equals(McpSchema.METHOD_NOTIFICATION_SUBSCRIPTIONS_ACKNOWLEDGED)) {

0 commit comments

Comments
 (0)