Skip to content
Open
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
6 changes: 5 additions & 1 deletion orleans/Chirper/Chirper.Grains/ChirperAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
using Microsoft.Extensions.Logging;
using Orleans.Concurrency;
using Orleans.Runtime;
using Orleans.Serialization.Invocation;

namespace Chirper.Grains;

[Reentrant]
[MayInterleave(nameof(WontFollowAndUnfollowSimultaneously))]
public sealed class ChirperAccount : Grain, IChirperAccount
{
/// <summary>
Expand Down Expand Up @@ -48,6 +49,9 @@ public ChirperAccount(
private static string GrainType => nameof(ChirperAccount);
private string GrainKey => this.GetPrimaryKeyString();

public static bool WontFollowAndUnfollowSimultaneously(IInvokable request) =>
request.GetMethodName() is not (nameof(FollowUserIdAsync) or nameof(UnfollowUserIdAsync));

public override Task OnActivateAsync(CancellationToken _)
{
_logger.LogInformation("{GrainType} {GrainKey} activated.", GrainType, GrainKey);
Expand Down