Skip to content

Conversation

@ChuntaoLu
Copy link
Contributor

@ChuntaoLu ChuntaoLu commented Aug 2, 2018

This PR cleans up the todos in codegen dir except those related to type convertor and middlewares. Relates to #411.

s.RUnlock()
return fmt.Errorf("handler for '%s' is already registered", e.Method)
}
s.RUnlock()
Copy link
Contributor

Choose a reason for hiding this comment

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

can we defer s.RUnlock? probably always need to unlock

Copy link
Contributor

Choose a reason for hiding this comment

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

there's another w-lock here :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As @cl1337 pointed out, deferring the rlock with cause the wlock to never succeed.

Copy link
Contributor

@cl1337 cl1337 left a comment

Choose a reason for hiding this comment

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

pending comments


// Register registers the given TChannelEndpoint.
func (s *TChannelRouter) Register(e *TChannelEndpoint) {
func (s *TChannelRouter) Register(e *TChannelEndpoint) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

mm ... are we calling this multi-threading? thought Register is sequential in main

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, Register is done in one goroutine, the locks in tchannel register is over kill for our use case, but since it's initialization only, so not a big deal.

@coveralls
Copy link

coveralls commented Aug 2, 2018

Coverage Status

Coverage increased (+0.2%) to 62.511% when pulling 7da96f3 on lu.todo into 6ac38be on master.

@ChuntaoLu ChuntaoLu merged commit 37d717b into master Aug 2, 2018
@ChuntaoLu ChuntaoLu deleted the lu.todo branch August 2, 2018 23:40
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.

5 participants