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

[routing] Akka.Routing refactoring #2719

Merged
merged 1 commit into from
Jun 6, 2017

Conversation

sean-gilliam
Copy link
Member

This PR refactors the classes in the Akka.Routing namespace to take
advantage of newer C# features. It also simplifies some of the logic in
the various routers.

@@ -153,38 +153,28 @@ public override RouterConfig WithFallback(RouterConfig routerConfig)

private RouterConfig OverrideUnsetConfig(RouterConfig other)
{
if (other is NoRouter)
if (other is Pool pool)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything that isn't a Pool returned this , so this is the only real check we need. Same with the other routers.


if (_hashMapping(message) != null)
var hashMapping = _hashMapping(message);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This delegate was being called twice which should return the same value each time. So I stored it in a variable so it only needed to be called once.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

This PR refactors the classes in the Akka.Routing namespace to take
advantage of newer C# features.  It also simplifies some of the logic in
the various routers.
@Aaronontheweb Aaronontheweb merged commit 85a27b0 into akkadotnet:v1.3 Jun 6, 2017
@Aaronontheweb
Copy link
Member

looks great @sean-gilliam - love seeing the C#7 features cutting down on code bloat

@sean-gilliam sean-gilliam deleted the routing_refactor branch June 7, 2017 00:31
switch (obj)
{
case null:
return new byte[] { 0 };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know the context, and how often this one called and maybe it's super micro, but seems like a constant?

Aaronontheweb pushed a commit to Aaronontheweb/akka.net that referenced this pull request Jun 28, 2017
This PR refactors the classes in the Akka.Routing namespace to take
advantage of newer C# features.  It also simplifies some of the logic in
the various routers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants