Skip to content

Conversation

@NickCraver
Copy link
Collaborator

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.

NickCraver added 2 commits May 2, 2023 13:45
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.
@NickCraver NickCraver requested review from mgravell and philon-msft May 2, 2023 17:57
/// 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";
Copy link
Collaborator

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?

Copy link
Collaborator Author

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))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsNullOrWhiteSpace?

Copy link
Collaborator Author

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!

@NickCraver NickCraver merged commit 0dfa58f into main May 2, 2023
@NickCraver NickCraver deleted the craver/lib-name-defaults branch May 2, 2023 21:17
{
// 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");
Copy link
Collaborator

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

Copy link
Collaborator Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants