A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/StackExchange/StackExchange.Redis/issues/2176 below:

Batch issue with Sorted Sets in version 2.6.45 · Issue #2176 · StackExchange/StackExchange.Redis · GitHub

The latest 2.6.45 version seems to have an issue with batches that previous versions did not.

In the test below a sorted set is created. A batch is then created where another sorted set is created, then an intersect is done between the two sorted sets, then the data should be returned in with SortedSetRangeByRankAsync command. In prior versions, this worked well but in this version no data is returned in the SortedSetRangeByRankAsync command.

It does seem like the first two commands are being executed in the correct order as the intersect key does exist after the test below completes with the correct value. I'm wondering if the SortedSetRangeByRankAsync isn't being executed last though.

In the newest version, I also tried the SortedSetCombineAsync instead of the separate intersect and return data commands and it didn't return any data either.

    using var conn = Create();
    var db = conn.GetDatabase();

    var key = "TestKeyForRedis1";
    var key2 = "TestKeyForRedis2";
    var keyIntersect = "TestKeyForRedisIntersect";

    db.KeyDelete(key);
    db.KeyDelete(key2);
    db.KeyDelete(keyIntersect);
    db.SortedSetAdd(key, "a", 1345);

    var tasks = new List<Task>();
    var batch = db.CreateBatch();
    tasks.Add(batch.SortedSetAddAsync(key2, "a", 4567));
    tasks.Add(batch.SortedSetCombineAndStoreAsync(SetOperation.Intersect,
        keyIntersect, new RedisKey[] { key, key2 }));
    var rangeByRankTask = batch.SortedSetRangeByRankAsync(keyIntersect);
    tasks.Add(rangeByRankTask);
    batch.Execute();

    Task.WhenAll(tasks.ToArray());

    var rangeByRankSortedSetValues = rangeByRankTask.Result;

    int size = rangeByRankSortedSetValues.Length;
    Assert.Equal(1, size);
    string firstRedisValue = rangeByRankSortedSetValues.FirstOrDefault().ToString();
    Assert.Equal("a", firstRedisValue);

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4