LiamMorrow / OrgnalR

SignalR backplane implemented through Orleans
Apache License 2.0
35 stars 8 forks source link

[BUG] OrgnalR waits 5 seconds to get cluster client rather than using lifecycle #29

Closed LiamMorrow closed 1 year ago

LiamMorrow commented 1 year ago

Describe the bug Right now the backplane waits an arbitrary 5 seconds before subscribing to messages. This is to give the IClusterClient time to be ready - if it's not ready it will throw a null pointer exception (can see this when running the example project and removing the delay). Delay: https://github.com/LiamMorrow/OrgnalR/blob/master/src/OrgnalR.Backplane/OrgnalRHubLifetimeManager.cs#L81

To Reproduce

  1. Remove the Task delay at : https://github.com/LiamMorrow/OrgnalR/blob/master/src/OrgnalR.Backplane/OrgnalRHubLifetimeManager.cs#L81
  2. Run the example project

Expected behavior No null pointer

Additional context Orleans provides hooks into its lifecycle via the LifeCycleParticipant interface. This could likely be used to delay subscribing until it is ready: https://learn.microsoft.com/en-us/dotnet/orleans/implementation/orleans-lifecycle