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.git


The following commit(s) were added to refs/heads/main by this push:
     new 39cbb3936e chore: Test if materializerPromise is already completed 
first. (#2117)
39cbb3936e is described below

commit 39cbb3936e84d475f65d57ee5dd1e1d564964d41
Author: He-Pin(kerr) <hepin1...@gmail.com>
AuthorDate: Sun Aug 31 18:48:47 2025 +0800

    chore: Test if materializerPromise is already completed first. (#2117)
---
 .../src/main/scala/org/apache/pekko/stream/SystemMaterializer.scala | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/stream/src/main/scala/org/apache/pekko/stream/SystemMaterializer.scala 
b/stream/src/main/scala/org/apache/pekko/stream/SystemMaterializer.scala
index efd829d47d..05e18d97e4 100644
--- a/stream/src/main/scala/org/apache/pekko/stream/SystemMaterializer.scala
+++ b/stream/src/main/scala/org/apache/pekko/stream/SystemMaterializer.scala
@@ -96,7 +96,11 @@ final class SystemMaterializer(system: ExtendedActorSystem) 
extends Extension {
 
   val materializer: Materializer = {
     // block on async creation to make it effectively final
-    Await.result(systemMaterializerPromise.future, 
materializerTimeout.duration)
+    val future = systemMaterializerPromise.future
+    future.value match {
+      case Some(value) => value.get
+      case _           => Await.result(future, materializerTimeout.duration)
+    }
   }
 
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pekko.apache.org
For additional commands, e-mail: commits-h...@pekko.apache.org

Reply via email to