@@ -235,6 +235,13 @@ public async Task TestBasicRejectAsync()
235
235
{
236
236
var publishSyncSource = new TaskCompletionSource < bool > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
237
237
238
+ using var cancellationTokenSource = new CancellationTokenSource ( TestTimeout ) ;
239
+
240
+ cancellationTokenSource . Token . Register ( ( ) =>
241
+ {
242
+ publishSyncSource . SetCanceled ( ) ;
243
+ } ) ;
244
+
238
245
_conn . ConnectionShutdown += ( o , ea ) =>
239
246
{
240
247
HandleConnectionShutdown ( _conn , ea , ( args ) =>
@@ -261,8 +268,19 @@ public async Task TestBasicRejectAsync()
261
268
consumer . Received += async ( object sender , BasicDeliverEventArgs args ) =>
262
269
{
263
270
var c = sender as AsyncEventingBasicConsumer ;
264
- Assert . NotNull ( c ) ;
271
+ Assert . Same ( c , consumer ) ;
265
272
await _channel . BasicCancelAsync ( c . ConsumerTags [ 0 ] ) ;
273
+ /*
274
+ * https://github.com/rabbitmq/rabbitmq-dotnet-client/actions/runs/7450578332/attempts/1
275
+ * That job failed with a bizarre error where the delivery tag ack timed out:
276
+ *
277
+ * AI.TestAsyncConsumer.TestBasicRejectAsync channel 1 shut down:
278
+ * AMQP close-reason, initiated by Peer, code=406, text=
279
+ * 'PRECONDITION_FAILED - delivery acknowledgement on channel 1 timed out. Timeout value used: 1800000 ms ...', classId=0, methodId=0
280
+ *
281
+ * Added Task.Yield() to see if it ever happens again.
282
+ */
283
+ await Task . Yield ( ) ;
266
284
await _channel . BasicRejectAsync ( args . DeliveryTag , true ) ;
267
285
publishSyncSource . TrySetResult ( true ) ;
268
286
} ;
0 commit comments