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

enhancement/read-only-on-get #18

Merged
merged 3 commits into from
May 28, 2019
Merged

Conversation

decanus
Copy link
Contributor

@decanus decanus commented May 27, 2019

No description provided.

@decanus decanus requested a review from mandrigin May 27, 2019 14:37
Copy link

@mandrigin mandrigin left a comment

Choose a reason for hiding this comment

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

yep, that is exactly what I meant! 👍

state.go Outdated
s.RLock()
defer s.RUnlock()

if _, ok := s.state[group][id][sender]; !ok {

Choose a reason for hiding this comment

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

well, then you theoreticaly can even do

state, _ := s.state[group][id][sender]
return state

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would state not be nil @mandrigin?

Choose a reason for hiding this comment

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

it it is not a pointer, it shoudn't be it will be a default value of the struct

Choose a reason for hiding this comment

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

@decanus
Copy link
Contributor Author

decanus commented May 27, 2019

@mandrigin running this code seems to run into a deadlock at one point, need to investigate further.

@mandrigin
Copy link

It’s unlikely there, this code is pretty straightforward, but if you call Get or Set inside Map, that might bring trouble.

@decanus decanus merged commit e58b8ca into master May 28, 2019
@delete-merged-branch delete-merged-branch bot deleted the enhancement/read-only-on-get branch May 28, 2019 14:34
@decanus decanus restored the enhancement/read-only-on-get branch June 4, 2019 14:42
@decanus decanus deleted the enhancement/read-only-on-get branch June 4, 2019 14:43
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.

2 participants