-
Notifications
You must be signed in to change notification settings - Fork 360
Clone CreateResponseOptions #904
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
Clone CreateResponseOptions #904
Conversation
| @@ -633,7 +633,7 @@ internal virtual CreateResponseOptions CreatePerCallOptions(CreateResponseOption | |||
| { | |||
| CreateResponseOptions clonedOptions = userProvidedOptions is null | |||
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.
Should we consider doing a thread-static shared instance for default options rather than creating an instance per-call?
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.
What scenario did you have in mind where we'd use the default options? My assumption is that we'll typically only clone when someone is passing in a non-default options instance.
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.
We're doing a new() if there's no custom options passed. My suggestion is to replace that with a thread-static version. We need to be able to safely mutate for this call but there's no reason why we need a fresh instance each time, is there?
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.
Ah, makes sense. For some reason I thought this comment was on the clone method.
| [CodeGenType("CreateResponse")] | ||
| public partial class CreateResponseOptions | ||
| { | ||
| internal static readonly CreateResponseOptions Default = new CreateResponseOptions(); |
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.
Will this work without being [ThreadStatic]? Won't we end up with concurrency issues because of the mutation during operations?
No description provided.