-
Notifications
You must be signed in to change notification settings - Fork 1.5k
DefaultOptionsProvider: allow overriding LibName #2453
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
Conversation
If a wrapper package is generally in use in a deployment, it may want to override what we set as the library name in `CLIENT SETINFO lib-name <name>`. This allows doing so via the `DefaultOptionsProvider` (intentionally not on `ConfigurationOptions` directly as version isn't either). Note that this does NOT upgrade the test suite to 7.2.0 RC1. I did test and this works, but there are other breaks we need to evaluate - I'll open another PR separately to demonstrate.
| /// Gets the library name to use for CLIENT SETINFO lib-name calls to Redis during handshake. | ||
| /// Defaults to "SE.Redis". | ||
| /// </summary> | ||
| public virtual string LibraryName => "SE.Redis"; |
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 use RedisLiterals.SE_Redis?
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.
Nah...but we should clean that up, done!
| msg.SetInternalCall(); | ||
| await WriteDirectOrQueueFireAndForgetAsync(connection, msg, ResultProcessor.DemandOK).ForAwait(); | ||
| var libName = Multiplexer.RawConfig.Defaults.LibraryName; | ||
| if (!string.IsNullOrEmpty(libName)) |
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.
IsNullOrWhiteSpace?
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.
YES, meant this - good catch!
| { | ||
| // note that this is a relatively new feature, but usually we won't know the | ||
| // server version, so we will use this speculatively and hope for the best | ||
| log?.WriteLine($"{Format.ToString(this)}: Setting client lib/ver"); |
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.
a bit late now, but: maybe this should be inside the null/empty check
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.
Agree it's weird, but there are 2 distinct checks and 1 log message atm - we could log each, change the method, or something else - thoughts? Happy to tidy up!
If a wrapper package is generally in use in a deployment, it may want to override what we set as the library name in
CLIENT SETINFO lib-name <name>. This allows doing so via theDefaultOptionsProvider(intentionally not onConfigurationOptionsdirectly as version isn't either).Note that this does NOT upgrade the test suite to 7.2.0 RC1. I did test and this works, but there are other breaks we need to evaluate - I'll open another PR separately to demonstrate.