-
Notifications
You must be signed in to change notification settings - Fork 217
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
Share connection across different clients #881
Conversation
…ction # Conflicts: # test/integration_test.go
// this package and cannot be wrapped. Currently, this always attempts an eager | ||
// connection even if the existing client was created with NewLazyClient and has | ||
// not made any calls yet. | ||
func NewClientFromExisting(existingClient Client, options Options) (Client, error) { |
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 might make sense to make a narrower options type here with just the stuff that won't be ignored.
If that can be re-used in a backwards compat way inside the existing options, that's gravy. If not it might still be worth it just to make this less potentially confusing, but up to you.
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.
In theory I like splitting the struct into "connection options" and "other options" but I don't think it's worth it for this feature that most people won't ever use
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 might make sense to make a narrower options type here with just the stuff that won't be ignored.
This can't be done in a backwards compatible way. I'd have to make a whole new struct. This would entail just copying all but two fields of the existing struct just for this method and hoping I properly keep them and their docs in sync when adding more. I think it's reasonable to reuse these options explaining which are unused.
// this package and cannot be wrapped. Currently, this always attempts an eager | ||
// connection even if the existing client was created with NewLazyClient and has | ||
// not made any calls yet. | ||
func NewClientFromExisting(existingClient Client, options Options) (Client, error) { |
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.
In theory I like splitting the struct into "connection options" and "other options" but I don't think it's worth it for this feature that most people won't ever use
// Since this interceptor can be used for clients of different name, we | ||
// attempt to extract the namespace out of the request. All namespace-based | ||
// requests have been confirmed to have a top-level namespace field. |
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.
Does this deserve a comment in the proto file? I mean I wouldn't do a PR just for that, but bundle it into your next api PR? :)
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.
Yeah, if I remember on my next one I'll add something like "Some clients expect all namespace-based RPC calls to have a single namespace
string field in the request".
What was changed
NewClientFromExisting
function to create a new client with the same connection but different client optionsWhy?
Users want to use the same connection for multiple namespaces
Checklist