@@ -73,8 +73,9 @@ public async Task TestBasicConsumeCancellation_GH1750()
73
73
Assert . Null ( _channel ) ;
74
74
75
75
_connFactory = CreateConnectionFactory ( ) ;
76
- _connFactory . AutomaticRecoveryEnabled = false ;
77
- _connFactory . TopologyRecoveryEnabled = false ;
76
+ _connFactory . NetworkRecoveryInterval = TimeSpan . FromMilliseconds ( 250 ) ;
77
+ _connFactory . AutomaticRecoveryEnabled = true ;
78
+ _connFactory . TopologyRecoveryEnabled = true ;
78
79
79
80
_conn = await _connFactory . CreateConnectionAsync ( ) ;
80
81
_channel = await _conn . CreateChannelAsync ( ) ;
@@ -87,11 +88,20 @@ public async Task TestBasicConsumeCancellation_GH1750()
87
88
return Task . CompletedTask ;
88
89
} ;
89
90
91
+ bool sawConnectionShutdown = false ;
92
+ _conn . ConnectionShutdownAsync += ( o , ea ) =>
93
+ {
94
+ sawConnectionShutdown = true ;
95
+ return Task . CompletedTask ;
96
+ } ;
97
+
90
98
try
91
99
{
92
100
// 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
+ */
95
105
96
106
// Note: use these to test timeout of the continuation RPC operation
97
107
using var cts = new CancellationTokenSource ( TimeSpan . FromMinutes ( 5 ) ) ;
@@ -102,6 +112,10 @@ public async Task TestBasicConsumeCancellation_GH1750()
102
112
{
103
113
_output . WriteLine ( "ex: {0}" , ex ) ;
104
114
}
115
+
116
+ await Task . Delay ( 500 ) ;
117
+
118
+ Assert . False ( sawConnectionShutdown ) ;
105
119
}
106
120
}
107
121
}
0 commit comments