1
+ using Microsoft . Extensions . Options ;
1
2
using Shouldly ;
2
3
using TinyIpc . IO ;
3
4
using TinyIpc . Synchronization ;
@@ -77,10 +78,15 @@ public async Task All_messages_should_be_processed_even_with_multiple_buses_in_a
77
78
var secondRound = 16 ;
78
79
var total = firstRound + secondRound ;
79
80
var rnd = new Random ( ) ;
81
+ var options = new OptionsWrapper < TinyIpcOptions > ( new TinyIpcOptions
82
+ {
83
+ // Use long lived messages in this test because GitHub Actions runners are SLOW
84
+ MinMessageAge = TimeSpan . FromSeconds ( 5 ) ,
85
+ } ) ;
80
86
81
87
// Start up two chatty buses talking to each other
82
- using var messagebus1 = new TinyMessageBus ( name ) ;
83
- using var messagebus2 = new TinyMessageBus ( name ) ;
88
+ using var messagebus1 = new TinyMessageBus ( name , options ) ;
89
+ using var messagebus2 = new TinyMessageBus ( name , options ) ;
84
90
85
91
var buses = new [ ] { messagebus1 , messagebus2 } ;
86
92
@@ -90,8 +96,12 @@ public async Task All_messages_should_be_processed_even_with_multiple_buses_in_a
90
96
await buses [ rnd . Next ( ) % buses . Length ] . PublishAsync ( messages , cancellationToken ) ;
91
97
}
92
98
99
+ // Force a read of all messages to work around timing issues
100
+ await messagebus1 . ReadAsync ( ) ;
101
+ await messagebus2 . ReadAsync ( ) ;
102
+
93
103
// Add a new bus to the mix
94
- using var messagebus3 = new TinyMessageBus ( name ) ;
104
+ using var messagebus3 = new TinyMessageBus ( name , options ) ;
95
105
96
106
buses = [ messagebus1 , messagebus2 , messagebus3 ] ;
97
107
@@ -101,7 +111,7 @@ public async Task All_messages_should_be_processed_even_with_multiple_buses_in_a
101
111
await buses [ rnd . Next ( ) % buses . Length ] . PublishAsync ( messages , cancellationToken ) ;
102
112
}
103
113
104
- // Force a final read of all messages to work around timing issuees
114
+ // Force a final read of all messages to work around timing issues
105
115
await messagebus1 . ReadAsync ( ) ;
106
116
await messagebus2 . ReadAsync ( ) ;
107
117
await messagebus3 . ReadAsync ( ) ;
0 commit comments