Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quit immediately when reconnecting #410

Conversation

ruimarinho
Copy link
Contributor

I'm not sure if this is the right approach but the idea is to be able to quit immediately when redis.quit() is called and the client is in the reconnecting state. In this case, quit() should not have to wait for the connection to be ready.

What do you think?

@ruimarinho ruimarinho force-pushed the enhancement/quit-immediately-when-reconnecting branch from dd6248e to dc8703c Compare December 21, 2016 16:40
@ruimarinho
Copy link
Contributor Author

@luin do you have time for some feedback here?

@luin
Copy link
Collaborator

luin commented Jan 3, 2017

Sorry for the late response. There's a problem that the QUIT command returns an OK so the command.resolve() should reflect it.

@ruimarinho ruimarinho force-pushed the enhancement/quit-immediately-when-reconnecting branch from dc8703c to 675aa59 Compare January 3, 2017 23:12
@ruimarinho
Copy link
Contributor Author

No problem, I appreciate your time! Is that a simple OK or [null, OK]? From the Redis specification it looks like it's a Simple String Response. I've updated the PR to reply with an OK for now.

@luin
Copy link
Collaborator

luin commented Jan 4, 2017

I think command.resolve('OK') should be command.resolve(new Buffer('OK')) to handle the case that users call redis.quitBuffer().

We'd better also include a test for it:

redis.quitBuffer().then(function (result) {
    expect(result).to.be.instanceof(Buffer);
    expect(result.toString()).to.eql('OK');
})

@ruimarinho
Copy link
Contributor Author

SGTM! Do you think this should be a separate test?

@luin
Copy link
Collaborator

luin commented Jan 4, 2017

Yes I think it should be a separate test since quit & quitBuffer are two different commands.

@ruimarinho ruimarinho force-pushed the enhancement/quit-immediately-when-reconnecting branch from 675aa59 to f261f0e Compare January 4, 2017 10:20
@ruimarinho
Copy link
Contributor Author

Let me know if you like the style of the new test.

@luin
Copy link
Collaborator

luin commented Jan 4, 2017

LGTM! 👍

@luin luin merged commit a6f04f2 into redis:master Jan 4, 2017
@ruimarinho ruimarinho deleted the enhancement/quit-immediately-when-reconnecting branch January 4, 2017 10:32
@ruimarinho
Copy link
Contributor Author

@luin would you be up to a patch/minor release which includes this PR? Not urgent, only if you have spare time and agree with it. Thanks!

@luin
Copy link
Collaborator

luin commented Jan 6, 2017

Sure! Just released v2.5.0. Thank you for the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants