-
Notifications
You must be signed in to change notification settings - Fork 495
Use sync.Map for websocket cancelContext map #3368
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
Use sync.Map for websocket cancelContext map #3368
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use sync.Map() @cesnietor
@harshavardhana what are the advantages of it? other than repetitive code? |
b651f6b to
546e322
Compare
It avoids map and mutex. Just one data structure and simpler to use. |
|
@cesnietor PTAL build failure |
@kannappanr build works, is just the vulnerability check, which can be addressed in other PR. |
There is a race condition while accessing the cancelContext map.
Since we delete and add values to it in goroutines we need to be sure there's no race condition.
This code is using a different pattern than that of trace or watch.
Test Steps: