Skip to content

Commit

Permalink
force wait for join
Browse files Browse the repository at this point in the history
  • Loading branch information
rogeralsing committed Sep 17, 2023
1 parent 83a9cfd commit fac0d5a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Proto.Cluster/DefaultClusterContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,25 @@ namespace Proto.Cluster;

public class DefaultClusterContext : IClusterContext
{
#pragma warning disable CS0618 // Type or member is obsolete
private static readonly ILogger Logger = Log.CreateLogger<DefaultClusterContext>();
#pragma warning restore CS0618 // Type or member is obsolete

private readonly IIdentityLookup _identityLookup;

private readonly PidCache _pidCache;
private readonly ShouldThrottle _requestLogThrottle;
private readonly ActorSystem _system;
private static readonly ILogger Logger = Log.CreateLogger<DefaultClusterContext>();
private readonly int _requestTimeoutSeconds;
private readonly bool _legacyTimeouts;
private readonly Cluster _cluster;

public DefaultClusterContext(Cluster cluster)
{
_identityLookup = cluster.IdentityLookup;
_pidCache = cluster.PidCache;
var config = cluster.Config;
_system = cluster.System;
_cluster = cluster;

_requestLogThrottle = Throttle.Create(
config.MaxNumberOfEventsInRequestLogThrottlePeriod,
Expand All @@ -48,6 +52,11 @@ public DefaultClusterContext(Cluster cluster)
public async Task<T?> RequestAsync<T>(ClusterIdentity clusterIdentity, object message, ISenderContext context,
CancellationToken ct)
{
if (!_cluster.JoinedCluster.IsCompletedSuccessfully)
{
await _cluster.JoinedCluster;
}

var i = 0;

var future = context.GetFuture();
Expand Down

0 comments on commit fac0d5a

Please sign in to comment.