refactor(mcp) Disable stdio server sink draining on close
This commit is contained in:
parent
47b09165c5
commit
dfa7435ad8
1 changed files with 39 additions and 35 deletions
|
|
@ -248,12 +248,14 @@ public class StdioServerTransport implements McpTransport {
|
||||||
return Mono.fromRunnable(() -> {
|
return Mono.fromRunnable(() -> {
|
||||||
isClosing = true;
|
isClosing = true;
|
||||||
logger.debug("Initiating graceful shutdown");
|
logger.debug("Initiating graceful shutdown");
|
||||||
}).then(Mono.defer(() -> {
|
})
|
||||||
// First complete the sinks to stop processing
|
// .then(Mono.defer(() -> {
|
||||||
inboundSink.tryEmitComplete();
|
// // First complete the sinks to stop processing
|
||||||
outboundSink.tryEmitComplete();
|
// inboundSink.tryEmitComplete();
|
||||||
return Mono.delay(Duration.ofMillis(200));
|
// outboundSink.tryEmitComplete();
|
||||||
})).then(Mono.fromRunnable(() -> {
|
// return Mono.delay(Duration.ofMillis(100));
|
||||||
|
// }))
|
||||||
|
.then(Mono.fromRunnable(() -> {
|
||||||
try {
|
try {
|
||||||
// Dispose schedulers first
|
// Dispose schedulers first
|
||||||
inboundScheduler.dispose();
|
inboundScheduler.dispose();
|
||||||
|
|
@ -287,7 +289,9 @@ public class StdioServerTransport implements McpTransport {
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
logger.error("Error during graceful shutdown", e);
|
logger.error("Error during graceful shutdown", e);
|
||||||
}
|
}
|
||||||
})).then().subscribeOn(Schedulers.boundedElastic());
|
}))
|
||||||
|
.then()
|
||||||
|
.subscribeOn(Schedulers.boundedElastic());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue