Skip to content

Commit 08ce006

Browse files
authored
CI-Fix: Add exponential backoff retries to ensure auto-flush mechanism runs before assertion (#76)
* CI-Fix:Increment sleep duration to ensure auto-flush mechanism runs before assertion * Add retry logic to avoid unnecessary wait time in auto-flush assertion.
1 parent 8556bde commit 08ce006

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

spec/codecs/identity_map_codec_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,9 @@
271271
l_2 = Mlc::LineListener.new(queue, imc, "stream3").tap {|o| o.accept("baz")}
272272
end
273273
it "three events are auto flushed from three different identities/codecs" do
274-
sleep 0.6 # wait for auto_flush - in multiples of 0.5 plus 0.1
275-
expect(queue.size).to eq(3)
274+
sleep 0.6 # wait for auto_flush 1 PeriodicRunner cycle before assertion.
275+
# try a few times with exponential backoff as timing is not 100% guaranteed
276+
try(10) { expect(queue.size).to eq(3) }
276277
e1, e2, e3 = queue
277278
expect(e1.get("path")).to eq("stream1")
278279
expect(e1.get("message")).to eq("foo")

0 commit comments

Comments
 (0)