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 = () =>