-
Notifications
You must be signed in to change notification settings - Fork 754
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 caller object as callback listener ID #2734
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.
why not change the key to any
and use the object itself as the key? (I made the same comment here: #2733 (comment))
Make sense |
You might want to update the title of the PR as you are not using UUID anymore. |
@@ -130,7 +130,7 @@ type ( | |||
versionToClusterName map[int64]string | |||
|
|||
clusterCallbackLock sync.RWMutex | |||
clusterChangeCallback map[string]CallbackFn | |||
clusterChangeCallback map[any]CallbackFn |
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.
comparable
?
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.
it need to be comparable. not sure any would work.
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.
I believe any
here is an alias for interface{}
which is a type name and comparable. comparable
is a constraint which doesn't work here (can't be used as a type name).
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.
@yycptt is right. And it works here as it uses the struct pointer as key.
* Use struct as callback listener ID
What changed?
Use UUID as callback listener ID
Why?
Race conditional may happen if a new shard starts before the old one close
How did you test it?
Use current unit tests
Potential risks
Is hotfix candidate?