Description
Describe the bug
Update the StackExchange.Redis.Extensions.Core version from 9.1.0 to 10.1.0. However, the existing unit tests failed after the upgrade.
To Reproduce
Revert the NuGet package to version 9.1.0, debug the code to ascertain the count of keys matching a specific pattern, and confirm that it provides the accurate result. However, when using the newer version of the NuGet package, it consistently returns a count of 0 for keys matching the specified pattern.
Additional context
In the previous version 9.1.0, the code in RedisDatabase.cs at inside SearchKeysAsync method line 424 utilized the Database instance to execute a scan command:
var redisResult = await Database.ExecuteAsync("SCAN", nextCursor.ToString(), "MATCH", pattern, "COUNT", "1000").ConfigureAwait(false);
However, in the updated version, a modification is observed. Instead of using the Database instance, the code now employs an instance named unused within a loop iterating over servers:
var servers = ServerIteratorFactory
.GetServers(connectionPoolManager.GetConnection(), serverEnumerationStrategy)
.ToArray();
foreach (var unused in servers)
{
var redisResult = await unused.ExecuteAsync("SCAN", nextCursor.ToString(), "MATCH", pattern, "COUNT", "1000").ConfigureAwait(false);
// Additional code handling the redisResult may be present here.
}
Activity