From c8cccb8a7728a3cd84c0307dd7ce339d341baf0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20C=C3=A1mara?= Date: Thu, 23 Oct 2025 16:04:54 +0200 Subject: [PATCH 1/2] CI-Fix:Increment sleep duration to ensure auto-flush mechanism runs before assertion --- spec/codecs/identity_map_codec_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/codecs/identity_map_codec_spec.rb b/spec/codecs/identity_map_codec_spec.rb index 1190f36..e623d52 100644 --- a/spec/codecs/identity_map_codec_spec.rb +++ b/spec/codecs/identity_map_codec_spec.rb @@ -271,7 +271,7 @@ l_2 = Mlc::LineListener.new(queue, imc, "stream3").tap {|o| o.accept("baz")} end it "three events are auto flushed from three different identities/codecs" do - sleep 0.6 # wait for auto_flush - in multiples of 0.5 plus 0.1 + sleep 1 # wait for auto_flush 2 PeriodicRunner cycles to ensure it is executed before assertion. expect(queue.size).to eq(3) e1, e2, e3 = queue expect(e1.get("path")).to eq("stream1") From 651163b35ac582dd3ec5f5895e8a0f0a186135cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20C=C3=A1mara?= Date: Mon, 27 Oct 2025 08:20:51 +0100 Subject: [PATCH 2/2] Add retry logic to avoid unnecessary wait time in auto-flush assertion. --- spec/codecs/identity_map_codec_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/codecs/identity_map_codec_spec.rb b/spec/codecs/identity_map_codec_spec.rb index e623d52..0ef64ef 100644 --- a/spec/codecs/identity_map_codec_spec.rb +++ b/spec/codecs/identity_map_codec_spec.rb @@ -271,8 +271,9 @@ l_2 = Mlc::LineListener.new(queue, imc, "stream3").tap {|o| o.accept("baz")} end it "three events are auto flushed from three different identities/codecs" do - sleep 1 # wait for auto_flush 2 PeriodicRunner cycles to ensure it is executed before assertion. - expect(queue.size).to eq(3) + sleep 0.6 # wait for auto_flush 1 PeriodicRunner cycle before assertion. + # try a few times with exponential backoff as timing is not 100% guaranteed + try(10) { expect(queue.size).to eq(3) } e1, e2, e3 = queue expect(e1.get("path")).to eq("stream1") expect(e1.get("message")).to eq("foo")