Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
var maxParallelizationSemaphore = new SemaphoreSlim(maxParallelization, maxParallelization);

var maxQueuingCompounded = Math.Min(maxQueueingActions + maxParallelization, int.MaxValue);
var maxQueuingCompounded = (int) Math.Min((long) maxQueueingActions + maxParallelization, int.MaxValue);

Check failure on line 10 in src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs

View workflow job for this annotation

GitHub Actions / ubuntu-latest

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check failure on line 10 in src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs

View workflow job for this annotation

GitHub Actions / macos-latest

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check failure on line 10 in src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs

View workflow job for this annotation

GitHub Actions / windows-latest

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check failure on line 10 in src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs

View workflow job for this annotation

GitHub Actions / windows-latest

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check failure on line 10 in src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs

View workflow job for this annotation

GitHub Actions / windows-latest

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check failure on line 10 in src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs

View workflow job for this annotation

GitHub Actions / windows-latest

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check failure on line 10 in src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs

View workflow job for this annotation

GitHub Actions / windows-latest

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check failure on line 10 in src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs

View workflow job for this annotation

GitHub Actions / windows-latest

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check failure on line 10 in src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs

View workflow job for this annotation

GitHub Actions / windows-latest

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check failure on line 10 in src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs

View workflow job for this annotation

GitHub Actions / windows-latest

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check failure on line 10 in src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs

View workflow job for this annotation

GitHub Actions / windows-latest

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)

Check failure on line 10 in src/Polly/Bulkhead/BulkheadSemaphoreFactory.cs

View workflow job for this annotation

GitHub Actions / windows-latest

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)
var maxQueuedActionsSemaphore = new SemaphoreSlim(maxQueuingCompounded, maxQueuingCompounded);

return (maxParallelizationSemaphore, maxQueuedActionsSemaphore);
Expand Down
9 changes: 9 additions & 0 deletions test/Polly.Specs/Bulkhead/BulkheadAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ public void Should_throw_when_maxQueuingActions_less_than_zero()
.ParamName.ShouldBe("maxQueuingActions");
}

[Fact]
public void Should_not_throw_when_maxQueuingActions_is_int_MaxValue()
{
Action policy = () => Policy
.BulkheadAsync(1, int.MaxValue);

policy.ShouldNotThrow();
}

[Fact]
public void Should_throw_when_onBulkheadRejected_is_null()
{
Expand Down
9 changes: 9 additions & 0 deletions test/Polly.Specs/Bulkhead/BulkheadSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ public void Should_throw_when_maxParallelization_less_or_equal_to_zero()
.ParamName.ShouldBe("maxParallelization");
}

[Fact]
public void Should_not_throw_when_maxQueuingActions_is_int_MaxValue()
{
Action policy = () => Policy
.Bulkhead(1, int.MaxValue);

policy.ShouldNotThrow();
}

[Fact]
public void Should_throw_when_maxQueuedActions_less_than_zero()
{
Expand Down
9 changes: 9 additions & 0 deletions test/Polly.Specs/Bulkhead/BulkheadTResultSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ public void Should_throw_when_maxParallelization_less_or_equal_to_zero()
.ParamName.ShouldBe("maxParallelization");
}

[Fact]
public void Should_not_throw_when_maxQueuingActions_is_int_MaxValue()
{
Action policy = () => Policy
.Bulkhead<int>(1, int.MaxValue);

policy.ShouldNotThrow();
}

[Fact]
public void Should_throw_when_maxQueuingActions_less_than_zero()
{
Expand Down
Loading