GithubHelp home page GithubHelp logo

Comments (6)

greensky00 avatar greensky00 commented on July 22, 2024

@FletcherJ1
You're right, thanks for letting us know.

Would you mind submitting PR for this fix? Thanks.

from nuraft.

FletcherJ1 avatar FletcherJ1 commented on July 22, 2024

Yeah of course. No worries.

from nuraft.

FletcherJ1 avatar FletcherJ1 commented on July 22, 2024

Also, another problem I've just noticed is that the rpc send call is async leading to the result being returned before it is populated by the callback. This is fine if the return method is set to async but when using blocking it will immediately return when using auto-forwarding resulting in a false result. I'm not sure how to change rpc send to be blocking in this case.

from nuraft.

FletcherJ1 avatar FletcherJ1 commented on July 22, 2024

I've made a patch for this but I'm not sure if it is the best way. I've added a method into cmd_result called wait() which uses the internal condition variable cv_. Then, when the callback is called from the rpc send method it calls set_result which notifies any waiting threads to continue. The wait/notify functionality is already present for set_result() and get() but I can't use get() due to the way append_entries() creates the cmd_result variable making get() immediately return because it thinks there is already a result.

Hope that makes sense. I can submit a separate PR for this or combine it into #132.

from nuraft.

greensky00 avatar greensky00 commented on July 22, 2024

Thanks @FletcherJ1 ! I just merged your current PR.

Regarding get() and wait() function, can you please elaborate more? I believed get() will wait until set_result() is invoked, as has_result_ is initialized to false. Once you submit your new PR first, and we can discuss it on the PR directly.

from nuraft.

FletcherJ1 avatar FletcherJ1 commented on July 22, 2024

Okay, I'll submit a PR and discuss there. I'll close this since it's fixed.

from nuraft.

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.