Skip to content

Commit 4296ea6

Browse files
committed
Simplify critical log check
1 parent 5dae60e commit 4296ea6

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/ModelContextProtocol.AspNetCore/StatefulSessionManager.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,9 @@ public async ValueTask StartNewSessionAsync(StreamableHttpSession newSession, Ca
7070
}
7171
else
7272
{
73-
if (Volatile.Read(ref _currentIdleSessionCount) >= _maxIdleSessionCount)
74-
{
75-
// This indicates all idle sessions are in the process of being disposed which should not happen during normal operation.
76-
// Since there are no idle sessions to prune right now, log a critical error and create the new session anyway.
77-
LogTooManyIdleSessionsClosingConcurrently(newSession.Id, _maxIdleSessionCount, Volatile.Read(ref _currentIdleSessionCount));
78-
}
79-
73+
// This indicates all idle sessions are in the process of being disposed which should not happen during normal operation.
74+
// Since there are no idle sessions to prune right now, log a critical error and create the new session anyway.
75+
LogTooManyIdleSessionsClosingConcurrently(newSession.Id, _maxIdleSessionCount, Volatile.Read(ref _currentIdleSessionCount));
8076
AddSession(newSession);
8177
return;
8278
}

0 commit comments

Comments
 (0)