This is an automated email from the ASF dual-hosted git repository.

hepin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-http.git


The following commit(s) were added to refs/heads/main by this push:
     new 35b88a896 fix: port ExpiringLfuCacheSpec race fix (#978)
35b88a896 is described below

commit 35b88a8965b0599a75bb07aaaec301e78500afb8
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Sun Mar 8 17:57:39 2026 +0800

    fix: port ExpiringLfuCacheSpec race fix (#978)
    
    Port akka-http commit 87c9bdcbc by replacing a fixed sleep with awaitAssert 
in the cache capacity test.
    
    Co-authored-by: Copilot <[email protected]>
---
 .../scala/org/apache/pekko/http/caching/ExpiringLfuCacheSpec.scala | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git 
a/http-caching/src/test/scala/org/apache/pekko/http/caching/ExpiringLfuCacheSpec.scala
 
b/http-caching/src/test/scala/org/apache/pekko/http/caching/ExpiringLfuCacheSpec.scala
index 52e4424b1..338cf3090 100755
--- 
a/http-caching/src/test/scala/org/apache/pekko/http/caching/ExpiringLfuCacheSpec.scala
+++ 
b/http-caching/src/test/scala/org/apache/pekko/http/caching/ExpiringLfuCacheSpec.scala
@@ -23,6 +23,7 @@ import org.apache.pekko
 import pekko.actor.ActorSystem
 import pekko.http.caching.scaladsl.CachingSettings
 import pekko.testkit.TestKit
+import pekko.testkit.TestProbe
 
 import org.scalatest.BeforeAndAfterAll
 import org.scalatest.matchers.should.Matchers
@@ -125,8 +126,10 @@ class ExpiringLfuCacheSpec extends AnyWordSpec with 
Matchers with BeforeAndAfter
       Await.result(cache(2, () => Future.successful("B")), 3.seconds) should 
be("B")
       Await.result(cache.get(3, () => "C"), 3.seconds) should be("C")
       cache.get(4, () => "D")
-      Thread.sleep(50)
-      cache.size should be(3)
+      val probe = TestProbe()
+      probe.awaitAssert {
+        cache.size should be(3)
+      }
     }
     "not cache exceptions" in {
       val cache = lfuCache[String]()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to