node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

Add a way for configurable socket timeouts

Open flippmoke opened this issue 6 years ago • 14 comments

Pull Request check-list

Please make sure to review and check all of these items:

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

NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.

Description of change

Added a way for connected sockets to timeout. This is important for situations where a connected server stops responding and the connection should close in a reasonable time.

flippmoke avatar Apr 23 '19 12:04 flippmoke

@BridgeAR I would support putting this in because you would need to access the the stream property directly on a connect event and this seems like a lot of extra work. Additionally, the other timeout option is confusing because its easy to assume that this timeout does exactly what this timeout option specifies.

flippmoke avatar May 20 '19 12:05 flippmoke

@BridgeAR I would support putting this in because you would need to access the the stream property directly on a connect event and this seems like a lot of extra work. Additionally, the other timeout option is confusing because its easy to assume that this timeout does exactly what this timeout option specifies.

👍 for @flippmoke comment @BridgeAR

DanielSeehausen avatar Oct 11 '19 16:10 DanielSeehausen

Bump on this?

flippmoke avatar Apr 27 '21 19:04 flippmoke

@flippmoke LGTM. Please resolve the conflicts with master, and I'll merge it.

leibale avatar Apr 27 '21 19:04 leibale

@leibale updated the branch, there are some failures but do not seem to be related to my changes.

flippmoke avatar Apr 28 '21 15:04 flippmoke

@flippmoke please fix those eslint errors: line 377 in test/connection.spec.js - Trailing spaces not allowed line 363 in index.js - Missing space before function parentheses

leibale avatar Apr 28 '21 15:04 leibale

@leibale sorry I missed those pushed now

flippmoke avatar Apr 28 '21 15:04 flippmoke

Hi @leibale @flippmoke @BridgeAR can you merge that PR and release a new version? as u can see in Issues section there are a lot of ppl that find the lack of this feature disturbing. In case of Redis server being unresponsive, the current implementation node-redis will cause the app to break since it will try to connect over an over again. Please merge this changes in order to allow us stop the connection after given time.

orzelek12 avatar Aug 31 '21 13:08 orzelek12

@dmaier-redislabs Any chance we can get this (or something similar) merged soon?

philon-msft avatar Mar 26 '25 18:03 philon-msft

@bobymicroby @elena-kolevska Can you please take a look and see if this can be merged before the next release?

dmaier-redislabs avatar Mar 26 '25 18:03 dmaier-redislabs

@philon-msft The code base has evolved significantly during the last few years, so this PR will not be easily mergeable. We recognize the need for such functionality (we have added this feature to ioredis recently), but we also recognize that such features need to be implemented carefully (see here a subsequent fix for connection instability caused by the socket timeout feature).

We are going to add this feature to the client with a new PR.

bobymicroby avatar Mar 27 '25 11:03 bobymicroby

Thanks @bobymicroby, will the new PR make it into the next release?

philon-msft avatar Mar 27 '25 15:03 philon-msft

@philon-msft probably, but cannot make commitments ; will ping you if there is movement on that

bobymicroby avatar Mar 28 '25 06:03 bobymicroby

Hi, this is the new PR for this change

nkaradzhov avatar May 19 '25 14:05 nkaradzhov