Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/core/Akka.Tests/Pattern/CircuitBreakerSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,19 @@ public async Task Must_increase_reset_timeout_after_it_transits_to_open_again()

public class CircuitBreakerSpecBase : AkkaSpec
{
public CircuitBreakerSpecBase()
{
// Pre-warm the thread pool so the breaker's fire-and-forget state-transition
// callbacks (dispatched via Task.Factory.StartNew) and the HashedWheelTimer reset
// timer are not starved by the runtime's throttled worker-thread injection
// (~500ms per new worker above the minimum). Cold-start starvation was
// intermittently pushing these transitions past the CountdownEvent latch timeouts
// on slower CI agents. Math.Max ensures a previously-raised minimum is never
// lowered. Mirrors InMemoryPersistenceSpecConfig.EnsureThreadPoolWarmed().
ThreadPool.GetMinThreads(out var minWorker, out var minIo);
ThreadPool.SetMinThreads(Math.Max(minWorker, Environment.ProcessorCount * 2), minIo);
}

public TimeSpan AwaitTimeout => Dilated(TimeSpan.FromSeconds(2));

public bool CheckLatch(CountdownEvent latch) => latch.Wait(AwaitTimeout);
Expand Down
Loading