Skip to content

Commit cae3e03

Browse files
committed
Investigate discussion #1793
Add a test to try and reproduce the `SemaphoreFullException`.
1 parent 1d5f574 commit cae3e03

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

projects/Test/Integration/GH/TestGitHubIssues.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,5 +329,45 @@ await ch.BasicPublishAsync(exchange: string.Empty, routingKey: queueName,
329329
_output.WriteLine("saw {0} publishExceptions", publishExceptions.Count);
330330
}
331331
}
332+
333+
[Fact]
334+
public async Task MaybeSomethingUpWithRateLimiter_GH1793()
335+
{
336+
_connFactory = new ConnectionFactory
337+
{
338+
AutomaticRecoveryEnabled = true
339+
};
340+
341+
_conn = await _connFactory.CreateConnectionAsync();
342+
343+
var channelOpts = new CreateChannelOptions(
344+
publisherConfirmationsEnabled: true,
345+
publisherConfirmationTrackingEnabled: true,
346+
outstandingPublisherConfirmationsRateLimiter: new ThrottlingRateLimiter(256)
347+
);
348+
349+
_channel = await _conn.CreateChannelAsync(channelOpts);
350+
351+
var properties = new BasicProperties
352+
{
353+
DeliveryMode = DeliveryModes.Persistent
354+
};
355+
int retryCount = 0;
356+
const int maxRetries = 3;
357+
while (retryCount <= maxRetries)
358+
{
359+
try
360+
{
361+
var bytes = Encoding.UTF8.GetBytes("message");
362+
await _channel.BasicPublishAsync(string.Empty, string.Empty, true, properties, bytes);
363+
break;
364+
}
365+
catch (Exception ex)
366+
{
367+
retryCount++;
368+
_output.WriteLine("{0} exception: {1}", _testDisplayName, ex);
369+
}
370+
}
371+
}
332372
}
333373
}

0 commit comments

Comments
 (0)