-
Notifications
You must be signed in to change notification settings - Fork 93
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
Client.ClientConfig public - invites race conditions #210
Comments
One possibility that comes to mind is the following
|
Another approach that comes to mind
|
@ZekeButlr the implementation of this change would be relatively simple; the question is more "should we make this change". Personally I feel that leaving ClientConfig public invites dangerous actions so it;s probably best to make it private (and I'm not sure that there is any real benefit to it being public). The one nice thing about a public is that you can do things like this:
i.e. use the client itself in a route. However I'm about to propose another way around that (suggesting we replace the router). |
Will leave the PR sitting for a few days in case anyone wants to review/has any further thoughts on this. |
Raising this issue for discussion purposes (as we are changing some API's we probably should consider others)
Is your feature request related to a problem? Please describe.
Client.ClientConfig
is public so users may be tempted to make changes; for example:This leads to race conditions; it's unsafe to change anything in the copy of
ClientConfig
held withinClient
(andmu
is private so, even if that did protect the config, its not usable).Describe the solution you'd like
I believe it probably makes more sense for the copy of
ClientConfig
held withinClient
to be private.Describe alternatives you've considered
We could just improve the documentation but I'm not sure that there is any reason for this to be public (and it's likely to create confusion in the future).
autopaho
stores it's configuration privately:The text was updated successfully, but these errors were encountered: