Giter Club home page Giter Club logo

Comments (7)

sewenew avatar sewenew commented on June 13, 2024 2

I did some research, and this is indeed a similar problem with the issue you mentioned. If you only call AsyncRedisCluster::redis to create an AsyncRedis object, and send command with this object, redis-plus-plus does not update the underlying node-slot mapping, and always send command to the old master.

Thanks for reporting the bug, and I'll try to fix it ASAP.

Before that, you can work around it by calling AsyncRedisCluster::get with the key you used, once you get an exception. This way, the underlying node-slot mapping will be updated, and redis-plus-plus will follow the MOVED indication.

Regards

from redis-plus-plus.

sewenew avatar sewenew commented on June 13, 2024 1

I fixed the problem, please try the latest code on dev branch. After some more tests, I'll merge the code into master branch.

You can use the following code to do a test:

auto cluster = RedisCluster("redis://127.0.0.1:7000");
while (true) {
    try {
        auto r = cluster.redis(key, false);
        cout << r.command<string>("ping") << endl;
    } catch (const Error &e) {
        cout << e.what() << endl;
    }

At the beginning, the test program prints "PONG". When the master that key located, is down, the program prints error message. When a new master is elected, the program prints "PONG" again.

You can try the latest fix. If you still has problem with it, feel free to let me know.

Sorry for the late fix. Too busy these days.

Regards

from redis-plus-plus.

sewenew avatar sewenew commented on June 13, 2024 1

Code has been merged into master branch. If you still have problem with it, feel free to reopen it.

Regards

from redis-plus-plus.

sewenew avatar sewenew commented on June 13, 2024 1

New release has been created. Enjoy it!

Regards

from redis-plus-plus.

georgasa avatar georgasa commented on June 13, 2024

Hi @sewenew , I'm facing the same issue, so please a quick correction would be more than welcome!

from redis-plus-plus.

georgasa avatar georgasa commented on June 13, 2024

Thanks a lot for the fix, could you please create a new release that includes the fix so as to incorporate it in our project?

from redis-plus-plus.

sewenew avatar sewenew commented on June 13, 2024

from redis-plus-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.