Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gossip error logger #2057

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Proto.Cluster/Cluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ private void SubscribeToTopologyEvents() =>
/// </summary>
public async Task StartMemberAsync()
{
await Gossip.StartGossipActorAsync().ConfigureAwait(false);
await BeginStartAsync(false).ConfigureAwait(false);
//gossiper must be started whenever any topology events starts flowing
await Gossip.StartAsync().ConfigureAwait(false);
await Gossip.StartgossipLoopAsync().ConfigureAwait(false);
MemberList.InitializeTopologyConsensus();
await Provider.StartMemberAsync(this).ConfigureAwait(false);
Logger.LogInformation("Started as cluster member");
Expand Down
12 changes: 11 additions & 1 deletion src/Proto.Cluster/Gossip/Gossiper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ public class Gossiper
{
public const string GossipActorName = "$gossip";

#pragma warning disable CS0618 // Type or member is obsolete
private static readonly ILogger Logger = Log.CreateLogger<Gossiper>();
#pragma warning restore CS0618 // Type or member is obsolete
private readonly Cluster _cluster;
private readonly IRootContext _context;
private PID _pid = null!;
Expand Down Expand Up @@ -143,6 +145,7 @@ public void SetState(string key, IMessage value)

if (_pid == null)
{
Logger.LogError("Gossiper is not started, cannot set state");
return;
}

Expand Down Expand Up @@ -178,7 +181,7 @@ public async Task SetStateAsync(string key, IMessage value)
}
}

internal Task StartAsync()
internal Task StartGossipActorAsync()
{
var props = Props.FromProducer(() => new GossipActor(
_cluster.System,
Expand All @@ -195,6 +198,13 @@ internal Task StartAsync()
tmp.Left.Clear();
_context.Send(_pid, tmp);
});

return Task.CompletedTask;
}

internal Task StartgossipLoopAsync()
{

Logger.LogInformation("Started Cluster Gossip");
_ = SafeTask.Run(GossipLoop);

Expand Down
Loading