@@ -254,29 +254,31 @@ public void TestPatternPubSub(bool preserveOrder)
254
254
255
255
#if DEBUG
256
256
[ Fact ]
257
- public void SubscriptionsSurviveConnectionFailure ( )
257
+ public async Task SubscriptionsSurviveConnectionFailureAsync ( )
258
258
{
259
259
using ( var muxer = Create ( allowAdmin : true ) )
260
260
{
261
261
RedisChannel channel = Me ( ) ;
262
262
var sub = muxer . GetSubscriber ( ) ;
263
263
int counter = 0 ;
264
- sub . Subscribe ( channel , delegate
264
+ await sub . SubscribeAsync ( channel , delegate
265
265
{
266
266
Interlocked . Increment ( ref counter ) ;
267
- } ) ;
268
- sub . Publish ( channel , "abc" ) ;
267
+ } ) . ConfigureAwait ( false ) ;
268
+ await sub . PublishAsync ( channel , "abc" ) . ConfigureAwait ( false ) ;
269
269
sub . Ping ( ) ;
270
+ await Task . Delay ( 200 ) . ConfigureAwait ( false ) ;
270
271
Assert . Equal ( 1 , VolatileWrapper . Read ( ref counter ) ) ;
271
272
var server = GetServer ( muxer ) ;
272
273
Assert . Equal ( 1 , server . GetCounters ( ) . Subscription . SocketCount ) ;
273
274
274
275
server . SimulateConnectionFailure ( ) ;
275
276
SetExpectedAmbientFailureCount ( 2 ) ;
276
- Thread . Sleep ( 100 ) ;
277
+ await Task . Delay ( 200 ) . ConfigureAwait ( false ) ;
277
278
sub . Ping ( ) ;
278
279
Assert . Equal ( 2 , server . GetCounters ( ) . Subscription . SocketCount ) ;
279
- sub . Publish ( channel , "abc" ) ;
280
+ await sub . PublishAsync ( channel , "abc" ) . ConfigureAwait ( false ) ;
281
+ await Task . Delay ( 200 ) . ConfigureAwait ( false ) ;
280
282
sub . Ping ( ) ;
281
283
Assert . Equal ( 2 , VolatileWrapper . Read ( ref counter ) ) ;
282
284
}
@@ -295,4 +297,4 @@ public static int Read(ref int location)
295
297
#endif
296
298
}
297
299
}
298
- }
300
+ }
0 commit comments