Improve testing for StreamableHttpHandler and IdleTrackingBackgroundService (#345)
* Add idle session pruning tests
* Remove redundant CTS from StreamableHttpHandler
* StreamableHttpServerTransport.HandlePostRequest already creates the equivelant CTS
which DeleteRequest_CompletesSession_WhichCancelsLongRunningToolCalls verifies
* Fix accept header validation for GET
* Use InvalidOperationException for transport-not-connected errors in doc comments
* Fix flaky Cancellation_ThrowsCancellationException test
This commit is contained in:
parent
4fd3ebf3fe
commit
e3ff552824
1 changed files with 315 additions and 291 deletions
|
|
@ -26,9 +26,17 @@ public class HttpServerTransportOptions
|
|||
/// Represents the duration of time the server will wait between any active requests before timing out an
|
||||
/// MCP session. This is checked in background every 5 seconds. A client trying to resume a session will
|
||||
/// receive a 404 status code and should restart their session. A client can keep their session open by
|
||||
/// keeping a GET request open. The default value is set to 2 minutes.
|
||||
/// keeping a GET request open. The default value is set to 2 hours.
|
||||
/// </summary>
|
||||
public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromMinutes(2);
|
||||
public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromHours(2);
|
||||
|
||||
/// <summary>
|
||||
/// The maximum number of idle sessions to track. This is used to limit the number of sessions that can be idle at once.
|
||||
/// Past this limit, the server will log a critical error and terminate the oldest idle sessions even if they have not reached
|
||||
/// their <see cref="IdleTimeout"/> until the idle session count is below this limit. Clients that keep their session open by
|
||||
/// keeping a GET request open will not count towards this limit. The default value is set to 100,000 sessions.
|
||||
/// </summary>
|
||||
public int MaxIdleSessionCount { get; set; } = 100_000;
|
||||
|
||||
/// <summary>
|
||||
/// Used for testing the <see cref="IdleTimeout"/>.
|
||||
|
|
|
|||
Loading…
Reference in a new issue