Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Akka.Annotations;
using Akka.Event;
using Akka.Routing;
using Akka.Util;
using Akka.Util.Internal;

namespace Akka.Cluster.Sharding
Expand Down Expand Up @@ -110,6 +111,9 @@ public DaemonMessageRouter(string[] entityIds, IActorRef shardingRef)
if (_entityIds.Length == 0)
throw new ArgumentException("At least one entityId must be provided", nameof(entityIds));
_shardingRef = shardingRef;

// pick a random index to start with to avoid hot-spot formation
_index = ThreadLocalRandom.Current.Next(_entityIds.Length);
}

protected override void OnReceive(object message)
Expand Down