Skip to content

Commit

Permalink
Hardened cluster-request deduplication (#2041)
Browse files Browse the repository at this point in the history
* Harden cluster request deduplication by keeping a sliding window of last processed timestamps.

* Bump default deduplication window to 1 min.
  • Loading branch information
mhelleborg authored Sep 6, 2023
1 parent deca94d commit efcef50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Proto.Actor/Deduplication/DeduplicationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public async Task DeDuplicate(MessageEnvelope envelope, Func<Task> continuation)
if (IsDuplicate(key!, cutoff))
{
_logger.LogInformation("Request de-duplicated");
// Update timestamp to keep a sliding window of TTL
_processed[key!]= now;

return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Proto.Cluster/ClusterConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private ClusterConfig(string clusterName, IClusterProvider clusterProvider, IIde
GossipFanout = 3;
GossipMaxSend = 50;
HeartbeatExpiration = TimeSpan.Zero;
ClusterRequestDeDuplicationWindow = TimeSpan.FromSeconds(30);
ClusterRequestDeDuplicationWindow = TimeSpan.FromMinutes(1);
IdentityLookup = identityLookup;
MemberStrategyBuilder = (_, _) => new SimpleMemberStrategy();
RemotePidCacheTimeToLive = TimeSpan.FromMinutes(15);
Expand Down

0 comments on commit efcef50

Please sign in to comment.