Skip to content

Commit d25f5ec

Browse files
authored
Merge pull request #246 from cnblogs/fix-node-locator-setting
fix: set UseLegacyNodeLocator before SetNodeLocator
2 parents b25aabc + 0e26ec0 commit d25f5ec

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/Enyim.Caching/Configuration/MemcachedClientConfiguration.cs

+6-7
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ public MemcachedClientConfiguration(
6060
}
6161
#endif
6262

63+
_useLegacyNodeLocator = options.UseLegacyNodeLocator;
6364
ConfigureServers(options);
65+
if (NodeLocator == null)
66+
{
67+
SetNodeLocator();
68+
}
6469

6570
SocketPool = new SocketPoolConfiguration();
6671
if (options.SocketPool != null)
@@ -155,12 +160,6 @@ public MemcachedClientConfiguration(
155160
_logger.LogDebug($"Use KeyTransformer Type : '{keyTransformer}'");
156161
}
157162

158-
_useLegacyNodeLocator = options.UseLegacyNodeLocator;
159-
if (NodeLocator == null)
160-
{
161-
SetNodeLocator();
162-
}
163-
164163
if (!string.IsNullOrEmpty(options.Transcoder))
165164
{
166165
try
@@ -234,7 +233,7 @@ private void SetNodeLocator()
234233
NodeLocator = typeof(SingleNodeLocator);
235234
}
236235

237-
_logger.LogDebug("Use NodeLocator: {NodeLocator}", NodeLocator);
236+
_logger.LogDebug("Use NodeLocator: {NodeLocator}. Current server count: {serverCount}", NodeLocator, Servers.Count);
238237
}
239238

240239
/// <summary>

0 commit comments

Comments
 (0)