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

Code refactoring #41

Open
edwardyoon opened this issue Mar 13, 2019 · 3 comments
Open

Code refactoring #41

edwardyoon opened this issue Mar 13, 2019 · 3 comments

Comments

@edwardyoon
Copy link
Owner

A member of Akka team provided great code review. We need to fix them at least.

akka/akka-http#2391 (comment)

@lkaihua
Copy link

lkaihua commented Mar 19, 2019

Would really appreciate your efforts to keep open source code updated!

@lkaihua
Copy link

lkaihua commented Apr 7, 2019

@jrudolph 's first suggestion is:

Try to get rid of mutable state as much as possible. Global mutable state in a singleton object (like ChatRooms) is absolutely forbidden ;)

In the latest version, the singleton ChatRoom still has a mutable variable to maintain the state:

var chatRooms: mutable.Map[Int, ActorRef]

It can be improved by using context.become:

context.become(update(chatRooms))

while update receives the current state as a parameter. (example)

@edwardyoon
Copy link
Owner Author

yeah, that's good point.

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

No branches or pull requests

2 participants