File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -189,13 +189,22 @@ func TestMessageExpiration(t *testing.T) {
189
189
t .Fatalf ("failed to inject message: %v" , err )
190
190
}
191
191
// Check that the message is inside the cache
192
- if _ , ok := node .messages [envelope .Hash ()]; ! ok {
192
+ node .poolMu .RLock ()
193
+ _ , found := node .messages [envelope .Hash ()]
194
+ node .poolMu .RUnlock ()
195
+
196
+ if ! found {
193
197
t .Fatalf ("message not found in cache" )
194
198
}
195
199
// Wait for expiration and check cache again
196
200
time .Sleep (time .Second ) // wait for expiration
197
201
time .Sleep (expirationCycle ) // wait for cleanup cycle
198
- if _ , ok := node .messages [envelope .Hash ()]; ok {
202
+
203
+ node .poolMu .RLock ()
204
+ _ , found = node .messages [envelope .Hash ()]
205
+ node .poolMu .RUnlock ()
206
+
207
+ if found {
199
208
t .Fatalf ("message not expired from cache" )
200
209
}
201
210
}
You can’t perform that action at this time.
0 commit comments