diff --git a/spec/codecs/identity_map_codec_spec.rb b/spec/codecs/identity_map_codec_spec.rb index 1190f36..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 0.6 # wait for auto_flush - in multiples of 0.5 plus 0.1 - 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")