@@ -73,8 +73,9 @@ public async Task TestBasicConsumeCancellation_GH1750()
7373 Assert . Null ( _channel ) ;
7474
7575 _connFactory = CreateConnectionFactory ( ) ;
76- _connFactory . AutomaticRecoveryEnabled = false ;
77- _connFactory . TopologyRecoveryEnabled = false ;
76+ _connFactory . NetworkRecoveryInterval = TimeSpan . FromMilliseconds ( 250 ) ;
77+ _connFactory . AutomaticRecoveryEnabled = true ;
78+ _connFactory . TopologyRecoveryEnabled = true ;
7879
7980 _conn = await _connFactory . CreateConnectionAsync ( ) ;
8081 _channel = await _conn . CreateChannelAsync ( ) ;
@@ -87,11 +88,20 @@ public async Task TestBasicConsumeCancellation_GH1750()
8788 return Task . CompletedTask ;
8889 } ;
8990
91+ bool sawConnectionShutdown = false ;
92+ _conn . ConnectionShutdownAsync += ( o , ea ) =>
93+ {
94+ sawConnectionShutdown = true ;
95+ return Task . CompletedTask ;
96+ } ;
97+
9098 try
9199 {
92100 // Note: use this to test timeout via the passed-in RPC token
93- // using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(5));
94- // await _channel.BasicConsumeAsync(q.QueueName, true, consumer, cts.Token);
101+ /*
102+ using var cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(5));
103+ await _channel.BasicConsumeAsync(q.QueueName, true, consumer, cts.Token);
104+ */
95105
96106 // Note: use these to test timeout of the continuation RPC operation
97107 using var cts = new CancellationTokenSource ( TimeSpan . FromMinutes ( 5 ) ) ;
@@ -102,6 +112,10 @@ public async Task TestBasicConsumeCancellation_GH1750()
102112 {
103113 _output . WriteLine ( "ex: {0}" , ex ) ;
104114 }
115+
116+ await Task . Delay ( 500 ) ;
117+
118+ Assert . False ( sawConnectionShutdown ) ;
105119 }
106120 }
107121}
0 commit comments