From 8f26fd49755c1915df70cb58fbbf4c06e6f0c89d Mon Sep 17 00:00:00 2001 From: Roger Johansson Date: Sun, 10 Dec 2023 20:04:10 +0100 Subject: [PATCH] publish wait --- src/Proto.Actor/EventStream/EventStream.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Proto.Actor/EventStream/EventStream.cs b/src/Proto.Actor/EventStream/EventStream.cs index 68a7147639..1109cda58e 100644 --- a/src/Proto.Actor/EventStream/EventStream.cs +++ b/src/Proto.Actor/EventStream/EventStream.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Concurrent; +using System.Threading; using System.Threading.Channels; using System.Threading.Tasks; using JetBrains.Annotations; @@ -72,6 +73,11 @@ internal EventStream(ActorSystem system) public override void Publish(object msg) { + if (_pid == null) + { + SpinWait.SpinUntil(() => _pid != null); + } + foreach (var sub in Subscriptions.Values) { var action = () =>