Skip to content

Conversation

@betimer
Copy link
Contributor

@betimer betimer commented Nov 29, 2018

Pull Request check-list

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

Description of change

Add option for socket_initialdelay when calling socket.setKeepAlive from node API

@betimer
Copy link
Contributor Author

betimer commented Nov 29, 2018

This is critical as because of this issue: nodejs/node#24689 though at this stage cannot sure if it is node issue

@stockholmux
Copy link
Contributor

I'm going to go ahead and merge, but I think we should investigate the root cause here as we might need a default that isn't 0.

@stockholmux stockholmux merged commit 95b8f1a into redis:master Dec 4, 2018
@betimer
Copy link
Contributor Author

betimer commented Dec 4, 2018

@stockholmux I strongly agree to have a value which is not the default 0.
Created this PR to add the option but does not change the existing behaviour.
I think something like 5000~60000 milliseconds would be fine.

I can make the change if this sounds OK, also may i know when we might get the new version?

@stockholmux
Copy link
Contributor

I consulted with some colleagues on this. I don't think there is actually a rational/universal initial delay default. I'm ok with this as-is.

@betimer
Copy link
Contributor Author

betimer commented Dec 7, 2018

Nice. no worries, as long as this already provides an interface to whom, like us, facing the issue, to change the setting. Thank you @stockholmux

@RidgeA
Copy link

RidgeA commented Dec 14, 2018

Hi @betimer !
Is it possible to install the latest version of the library from NPM?
As I can see the library version was updated on NPM more than a year ago...

@Fundebug
Copy link

Fundebug commented May 9, 2019

@anhzhi I found that idle redis connection will be disconnected every 2 hours, it is strange. It is solved by using your code:

client.on('connect', function () {
    var socket = client.stream
    socket.setKeepAlive(true, 30 * 1000)
})

@RidgeA
Copy link

RidgeA commented May 9, 2019

This would work, but it is an ugly workaround. There is a special option for this, the package just need to be updated on npm. We have switched to ioredis package.

florian-schunk pushed a commit to florian-schunk/node-redis that referenced this pull request Jun 18, 2025
Add delay option for socket.setKeepAlive
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.

5 participants