Skip to content

Commit

Permalink
discard some parameters (#6751)
Browse files Browse the repository at this point in the history
Co-authored-by: Aaron Stannard <aaron@petabridge.com>
  • Loading branch information
SimonCropp and Aaronontheweb authored May 17, 2023
1 parent 88be1fc commit c514fd1
Show file tree
Hide file tree
Showing 256 changed files with 676 additions and 676 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private Reachability AddUnreachable(Reachability baseReachability, int count)
using var subjects = baseReachability.Versions.Keys.ToList().GetContinuousEnumerator();
return observers.Aggregate(baseReachability, (r, o) =>
{
return Enumerable.Range(1, 5).Aggregate(r, (r2, i) =>
return Enumerable.Range(1, 5).Aggregate(r, (r2, _) =>
{
subjects.MoveNext();
return r2.Unreachable(o, subjects.Current);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public EchoServer(int port)
Context.System.Tcp().Tell(new Tcp.Bind(Self, new IPEndPoint(IPAddress.Any, port)));

Receive<Tcp.Bound>(_ => { });
Receive<Tcp.Connected>(connected =>
Receive<Tcp.Connected>(_ =>
{
var connection = Context.ActorOf(Props.Create(() => new EchoConnection(Sender)));
Sender.Tell(new Tcp.Register(connection));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ public async Task Setup()
_addr2 = RARP.For(_sys2).Provider.DefaultAddress;

_senderActorRef =
_sys2.ActorOf(act => { act.ReceiveAny((o, context) => context.Sender.Tell(context.Sender)); },
_sys2.ActorOf(act => { act.ReceiveAny((_, context) => context.Sender.Tell(context.Sender)); },
"sender1");

_localReceiveRef = _sys1.ActorOf(act => { act.ReceiveAny((o, context) => context.Sender.Tell(context.Sender)); },
_localReceiveRef = _sys1.ActorOf(act => { act.ReceiveAny((_, context) => context.Sender.Tell(context.Sender)); },
"recv1");

// create an association
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public async Task Setup()
var name = "target" + ++_cacheHitPathCount;
_cacheHitActorRef = _sys1.ActorOf(act =>
{
act.ReceiveAny((o, context) => context.Sender.Tell(context.Sender));
act.ReceiveAny((_, context) => context.Sender.Tell(context.Sender));
}, name);

_cacheMissActorRef = await _cacheHitActorRef.Ask<IActorRef>("hit", CancellationToken.None);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void Setup()

simpleGraph = Source.Single(1)
.Select(x => x + 1)
.ToMaterialized(Sink.ForEach<int>(i => { }), Keep.Right);
.ToMaterialized(Sink.ForEach<int>(_ => { }), Keep.Right);
}

[GlobalCleanup]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ public BenchmarkDoneActor(int expected)
_asker = Sender;
});

Receive<Finished>(f =>
Receive<Finished>(_ =>
{
// this will terminate the benchmark
if(--_expected <= 0)
_asker.Tell(Done.Instance);
});

Receive<RecoveryFinished>(f =>
Receive<RecoveryFinished>(_ =>
{
// this will terminate the benchmark
if (--_expected <= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void WaitResult()
Become(WaitRequest);
});

ReceiveAny(msg =>
ReceiveAny(_ =>
Stash.Stash()
);

Expand Down Expand Up @@ -260,7 +260,7 @@ public static IActorRef StartShardRegion(ActorSystem system, string entityName =
{
var props = Props.Create(() => new ShardedEntityActor());
var sharding = ClusterSharding.Get(system);
return sharding.Start(entityName, s => props, ClusterShardingSettings.Create(system),
return sharding.Start(entityName, _ => props, ClusterShardingSettings.Create(system),
new ShardMessageExtractor());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/benchmark/PingPong/ClientAsyncActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public ClientAsyncActor(IActorRef actor, long repeat, TaskCompletionSource<bool>
latch.SetResult(true);
}
});
Receive<Messages.Run>(r =>
Receive<Messages.Run>(_ =>
{
var msg = new Messages.Msg();
for (int i = 0; i < Math.Min(1000, repeat); i++)
Expand Down
2 changes: 1 addition & 1 deletion src/benchmark/PingPong/ClientReceiveActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public ClientReceiveActor(IActorRef actor, long repeat, TaskCompletionSource<boo
latch.SetResult(true);
}
});
Receive<Messages.Run>(r =>
Receive<Messages.Run>(_ =>
{
var msg = new Messages.Msg();
for(int i = 0; i < Math.Min(1000, repeat); i++)
Expand Down
4 changes: 2 additions & 2 deletions src/benchmark/SerializationBenchmarks/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ public void NoPooling()
public void Pooling_MultiTasks()
{
Task.WaitAll(Enumerable.Repeat(0, 10)
.Select((l) => Task.Run(Pooling)).ToArray());
.Select((_) => Task.Run(Pooling)).ToArray());
}
[Benchmark]
public void NoPooling_MultiTasks()
{
Task.WaitAll(Enumerable.Repeat(0, 10)
.Select((l) => Task.Run(NoPooling)).ToArray());
.Select((_) => Task.Run(NoPooling)).ToArray());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ private Address FullAddress(IActorRef actorRef)

private IImmutableDictionary<Address, int> ReceiveReplies(int expectedReplies)
{
var zero = ImmutableDictionary<Address, int>.Empty.AddRange(Roles.ToDictionary(r => Node(r).Address, r => 0));
var zero = ImmutableDictionary<Address, int>.Empty.AddRange(Roles.ToDictionary(r => Node(r).Address, _ => 0));
return ReceiveWhile(5.Seconds(), msg => (msg as AdaptiveLoadBalancingRouterConfig.Reply)?.Address, expectedReplies)
.Aggregate(zero, (replyDict, address) => replyDict.SetItem(address, replyDict[address] + 1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ protected override Task<IImmutableList<Exception>> WriteMessagesAsync(IEnumerabl
.ContinueWith(r =>
{
if (r.IsCanceled)
return (IImmutableList<Exception>)trueMsgs.Select(i => (Exception)new TimeoutException()).ToImmutableList();
return (IImmutableList<Exception>)trueMsgs.Select(_ => (Exception)new TimeoutException()).ToImmutableList();
if (r.IsFaulted)
return trueMsgs.Select(i => (Exception)r.Exception).ToImmutableList();
return trueMsgs.Select(_ => (Exception)r.Exception).ToImmutableList();
return r.Result switch
{
WriteMessageSuccess wms => trueMsgs.Select(i => (Exception)null).ToImmutableList(),
WriteMessageFailure wmf => trueMsgs.Select(i => wmf.Cause).ToImmutableList(),
WriteMessageSuccess wms => trueMsgs.Select(_ => (Exception)null).ToImmutableList(),
WriteMessageFailure wmf => trueMsgs.Select(_ => wmf.Cause).ToImmutableList(),
_ => null
};
}, TaskContinuationOptions.ExecuteSynchronously);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ private void ClusterSharding_should_failover_shards_on_crashed_node()
{
// mute logging of deadLetters during shutdown of systems
if (!Log.IsDebugEnabled)
Sys.EventStream.Publish(new Mute(new DeadLettersFilter(new PredicateMatcher(x => true), new PredicateMatcher(x => true))));
Sys.EventStream.Publish(new Mute(new DeadLettersFilter(new PredicateMatcher(_ => true), new PredicateMatcher(_ => true))));
EnterBarrier("logs-muted");
RunOn(() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public async Task ReliableDelivery_with_sharding_and_durable_queue_must_load_ini

// <SpawnDurableConsumer>
var consumerProbe = CreateTestProbe();
var sharding = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", s =>
var sharding = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", _ =>
ShardingConsumerController.Create<Job>(c =>
Props.Create(() => new Consumer(c, consumerProbe)),
ShardingConsumerController.Settings.Create(Sys)), ClusterShardingSettings.Create(Sys),
Expand Down Expand Up @@ -169,7 +169,7 @@ public async Task ReliableDelivery_with_sharding_and_durable_queue_must_reply_to
NextId();

var consumerProbe = CreateTestProbe();
var sharding = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", s =>
var sharding = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", _ =>
ShardingConsumerController.Create<Job>(c =>
Props.Create(() => new Consumer(c, consumerProbe)),
ShardingConsumerController.Settings.Create(Sys)), ClusterShardingSettings.Create(Sys),
Expand Down Expand Up @@ -221,7 +221,7 @@ public Consumer(IActorRef consumerController, TestProbe consumerProbe)
_deliveryAdapter = Context.ActorOf(
act =>
{
act.Receive<ConsumerController.Delivery<Job>>((delivery, ctx) =>
act.Receive<ConsumerController.Delivery<Job>>((delivery, _) =>
{
self.Forward(new JobDelivery(delivery.Message, delivery.ConfirmTo, delivery.ProducerId,
delivery.SeqNr));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public async Task ReliableDelivery_with_Sharding_must_illustrate_Sharding_usage(
NextId();

var consumerEndProbe = CreateTestProbe();
var region = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", s =>
var region = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", _ =>
ShardingConsumerController.Create<Job>(c =>
PropsFor(DefaultConsumerDelay, 42, consumerEndProbe.Ref, c),
ShardingConsumerController.Settings.Create(Sys)), ClusterShardingSettings.Create(Sys),
Expand Down Expand Up @@ -96,7 +96,7 @@ public async Task ReliableDelivery_with_Sharding_must_illustrate_Sharding_usage_
NextId();

var consumerEndProbe = CreateTestProbe();
var region = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", s =>
var region = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", _ =>
ShardingConsumerController.Create<Job>(c =>
PropsFor(DefaultConsumerDelay, 42, consumerEndProbe.Ref, c),
ShardingConsumerController.Settings.Create(Sys)), ClusterShardingSettings.Create(Sys),
Expand Down Expand Up @@ -144,7 +144,7 @@ public async Task ReliableDelivery_with_Sharding_must_reply_to_MessageWithConfir
NextId();

var consumerEndProbe = CreateTestProbe();
var region = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", s =>
var region = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", _ =>
ShardingConsumerController.Create<Job>(c =>
PropsFor(DefaultConsumerDelay, 3, consumerEndProbe.Ref, c),
ShardingConsumerController.Settings.Create(Sys)), ClusterShardingSettings.Create(Sys),
Expand Down Expand Up @@ -335,9 +335,9 @@ public async Task
NextId();

var consumerIncarnation = new AtomicCounter(0);
var consumerProbes = Enumerable.Range(0, 3).Select(c => CreateTestProbe()).ToList();
var consumerProbes = Enumerable.Range(0, 3).Select(_ => CreateTestProbe()).ToList();

var region = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", s =>
var region = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", _ =>
ShardingConsumerController.Create<Job>(c =>
Props.Create(() => new ProbeWrapper(consumerProbes[consumerIncarnation.GetAndIncrement()], c)),
ShardingConsumerController.Settings.Create(Sys)), ClusterShardingSettings.Create(Sys),
Expand Down Expand Up @@ -430,7 +430,7 @@ public async Task
NextId();

var consumerEndProbe = CreateTestProbe();
var region = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", s =>
var region = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", _ =>
ShardingConsumerController.Create<Job>(c =>
Props.Create(() => new ProbeWrapper(consumerEndProbe, c)),
ShardingConsumerController.Settings.Create(Sys)), ClusterShardingSettings.Create(Sys),
Expand Down Expand Up @@ -507,7 +507,7 @@ public async Task
NextId();

var consumerEndProbe = CreateTestProbe();
var region = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", s =>
var region = await ClusterSharding.Get(Sys).StartAsync($"TestConsumer-{_idCount}", _ =>
ShardingConsumerController.Create<Job>(c =>
Props.Create(() => new ProbeWrapper(consumerEndProbe, c)),
ShardingConsumerController.Settings.Create(Sys)), ClusterShardingSettings.Create(Sys),
Expand Down Expand Up @@ -650,7 +650,7 @@ private void Active(int n, IActorRef sendTo)
Become(() => Idle(n));
});

Receive<RequestNext>(next => { }); // already active
Receive<RequestNext>(_ => { }); // already active
}

public sealed class Tick
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void RememberEntitiesStarter_must_try_start_all_entities_directly_with_en
RememberEntityStarter.Props(regionProbe.Ref, shardProbe.Ref, shardId, ImmutableHashSet.Create("1", "2", "3"), defaultSettings));

Watch(rememberEntityStarter);
var startedEntityIds = Enumerable.Range(1, 3).Select(i =>
var startedEntityIds = Enumerable.Range(1, 3).Select(_ =>
{
var start = regionProbe.ExpectMsg<ShardRegion.StartEntity>();
regionProbe.LastSender.Tell(new ShardRegion.StartEntityAck(start.EntityId, shardId));
Expand Down Expand Up @@ -95,7 +95,7 @@ public void RememberEntitiesStarter_must_retry_start_all_entities_with_no_ack_wi
{
var start = regionProbe.ExpectMsg<ShardRegion.StartEntity>();
}
var startedOnSecondTry = Enumerable.Range(1, 3).Select(i =>
var startedOnSecondTry = Enumerable.Range(1, 3).Select(_ =>
{
var start = regionProbe.ExpectMsg<ShardRegion.StartEntity>();
regionProbe.LastSender.Tell(new ShardRegion.StartEntityAck(start.EntityId, shardId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void TestRebalance(
var regions = Enumerable.Range(1, numberOfRegions).Select(n => LeastShardAllocationStrategySpec.NewFakeRegion($"{iteration}-R{n}", memberArray[n - 1]));

//var regions = Enumerable.Range(1, numberOfRegions).Select(n => Sys.ActorOf(Props.Empty, $"{iteration}-R{n}")).ToImmutableList();
var countPerRegion = regions.ToImmutableDictionary(region => region, region => rnd.Next(maxShardsPerRegion));
var countPerRegion = regions.ToImmutableDictionary(region => region, _ => rnd.Next(maxShardsPerRegion));
var allocations = CreateAllocations(countPerRegion);
TestRebalance(allocationStrategy, allocations, ImmutableList.Create(allocations), expectedMaxSteps);
foreach (var region in regions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void Migration_should_allow_migration_of_remembered_shards_and_not_allow_
{
var typeName = "Migration";

WithSystem(Sys.Settings.Config, typeName, "OldMode", (s, region, p) =>
WithSystem(Sys.Settings.Config, typeName, "OldMode", (_, region, _) =>
{
AssertRegionRegistrationComplete(region);
region.Tell(new Message(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public ShardRegionQueriesHashCodeSpecs(ITestOutputHelper outputHelper) : base(Ge
{
_clusterSharding = ClusterSharding.Get(Sys);
_cluster = Cluster.Get(Sys);
_shardRegion = _clusterSharding.Start("entity", s => EchoActor.Props(this, true),
_shardRegion = _clusterSharding.Start("entity", _ => EchoActor.Props(this, true),
ClusterShardingSettings.Create(Sys).WithRole("shard"), new MessageExtractor());

var proxySysConfig = ConfigurationFactory.ParseString("akka.cluster.roles = [proxy]")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ShardRegionQueriesSpecs(ITestOutputHelper outputHelper) : base(GetConfig(
{
_clusterSharding = ClusterSharding.Get(Sys);
_cluster = Cluster.Get(Sys);
_shardRegion = _clusterSharding.Start("entity", s => EchoActor.Props(this, true),
_shardRegion = _clusterSharding.Start("entity", _ => EchoActor.Props(this, true),
ClusterShardingSettings.Create(Sys).WithRole("shard"), ExtractEntityId, ExtractShardId);

var proxySysConfig = ConfigurationFactory.ParseString("akka.cluster.roles = [proxy]")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ private void WaitForStart()
Stash.UnstashAll();
});

Receive<ConsumerController.IConsumerCommand<T>>(command => { Stash.Stash(); });
Receive<ConsumerController.IConsumerCommand<T>>(_ => { Stash.Stash(); });

Receive<Terminated>(t =>
Receive<Terminated>(_ =>
{
_log.Debug("Consumer terminated before initialized.");
Context.Stop(Self);
Expand Down Expand Up @@ -94,7 +94,7 @@ private void Active()
}
});

Receive<Terminated>(t => t.ActorRef.Equals(_consumer), terminated =>
Receive<Terminated>(t => t.ActorRef.Equals(_consumer), _ =>
{
_log.Debug("Consumer terminated.");
Context.Stop(Self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected override void PreStart()
Context.ActorOf(
act =>
{
act.Receive<ProducerController.RequestNext<T>>((msg, ctx) =>
act.Receive<ProducerController.RequestNext<T>>((msg, _) =>
{
self.Forward(new WrappedRequestNext<T>(msg));
});
Expand Down Expand Up @@ -153,7 +153,7 @@ private void BecomeActive(IActorRef producer, Option<DurableProducerQueue.State<
var self = Self;
MsgAdapter = Context.ActorOf(act =>
{
act.Receive<ShardingEnvelope>((msg, ctx) => { self.Forward(new Msg(msg, 0)); });
act.Receive<ShardingEnvelope>((msg, _) => { self.Forward(new Msg(msg, 0)); });
act.ReceiveAny((_, ctx) =>
{
Expand Down Expand Up @@ -533,8 +533,8 @@ private void StoreMessageSent(DurableProducerQueue.MessageSent<T> messageSent, i

DurableQueueRef.Value.Ask<DurableProducerQueue.StoreMessageSentAck>(Mapper,
askTimeout, cancellationToken: default)
.PipeTo(self, success: ack => new StoreMessageSentCompleted<T>(messageSent),
failure: ex => new StoreMessageSentFailed<T>(messageSent, attempt));
.PipeTo(self, success: _ => new StoreMessageSentCompleted<T>(messageSent),
failure: _ => new StoreMessageSentFailed<T>(messageSent, attempt));
}

private RequestNext<T> CreateRequestNext(State<T> state)
Expand Down Expand Up @@ -600,7 +600,7 @@ private void AskLoadState(Option<IActorRef> durableProducerQueue, int attempt)
var self = Self;
@ref.Ask<DurableProducerQueue.State<T>>(Mapper, timeout: loadTimeout, cancellationToken: default)
.PipeTo(self, success: state => new LoadStateReply<T>(state),
failure: ex => new LoadStateFailed(attempt)); // timeout
failure: _ => new LoadStateFailed(attempt)); // timeout
});
}

Expand Down
Loading

0 comments on commit c514fd1

Please sign in to comment.