1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-03 04:01:40 +03:00

89 Commits

Author SHA1 Message Date
3d7668e543 fix: Update command-options.md with proper key 'RESP_TYPES' (#3040) 2025-07-29 16:41:09 +03:00
31c881e90e Default reconnect strategy uses exponential backoff and jitter (#2736)
* Default reconnect strategy uses exponential backoff and jitter

Both are recommended parts of client reconnect strategies to prevent
thundering herd problems when many clients lose their connection at once
(for example, during a Redis upgrade).

* Move default retry strategy to constant

* Plain english explanation of default 'socket.reconnectStrategy'

* Extract default connect strategy into helper function
2024-05-28 10:16:52 -04:00
f9252356ae docs 2024-02-28 14:33:26 -05:00
cf5587ec4a Update pub-sub.md 2024-02-19 13:18:40 -08:00
5ba5e093a8 Update pub-sub.md 2024-02-19 13:10:38 -08:00
77ecdf2721 fix #2679 - fix socket types, and clean some code 2024-02-12 18:38:00 -05:00
8f3a276509 Sentinel Support (#2664)
* redis client socket changes needed for sentinel

* Sentinel Implementation [EXPERIMENTAL]

* add pooling

* improve typing with SENTINEL_ client members

* cleanup - remove unused comments / commented code

* small sendCommand change + revert change to tsconfig

* add more sentinel commands needed for testing.

* lots of fixups and a reasonable first pass test suite

* add a timer option to update topology in background

+ don't need both sentinel client and pubsubclient
+ nits

* format all the things

* more progress

* small cleanup

* try to group promises together to minimize the internal await points

* redo events, to keep a single topology event to listen on

* nits + readme

* add RedisSentinelFactory to provide lower level access to sentinel

* nit

* update

* add RedisSentinelClient/Type for leased clients
	returned by aquire()
	used by function passed to use()

* add self for private access + improve emitting

* nit

* nits

* improve testing

- improve steady state waiting between tests
- get masternode from client, not from sentinels themselves (not consistent and then client isn't changing as we expect
- provide extensive logging/tracing on test errors
	- provide a very low impact tracing mechanism withinthe code that only really impacts code when tracing is in use.

* ismall nit for typing

* bunch of changes

- harden testing
	- don't use sentinel[0] for debug error dump as could be downed by a test
	- increase time for sentinel down test to 30s (caused a long taking failover)
- add client-error even / don't pass throuh client errors as errors option for pubsub proxy
- when passing through cient errors as error events, dont pass the event, but the Error object, as only Error objects are supposed to be on 'error'
	-

* improve pub sub proxy.

save the refference to all channel/pattern listeners up front on creation, dont hve to fetch the object each time, as it doesn't change.

removes race condition between setting up the listener and the pub sub node going down and being recreated.

* wrap the passed through RedisClient error to make clear where its coming from.

* refactor sentinel object / factory tests apart

* harden tests a little bit more

* add pipeline test

* add scripts/function tests + fixups / cleanups to get them to work

* change to use redis-stack-server for redis nodes to enable module testing

* fix test, forgot to return in use function with module

* rename test

* improve tests to test with redis/sentinel nodes with and withput passwords

this tests that we are handling the nodeClientOptions and sentinelClientOptions correctly

* cleanup for RedisSentinel type generic typing in tests

* remove debugLog, just rely on traace mechanism

* added multi tests for script/function/modules

* don't emit errors on lease object, only on main object

* improve testing

* extract out common code to reduce duplication

* nit

* nits

* nit

* remove SENTINEL_... commands from main client, load them via module interface

* missed adding RedisSentinelModule to correct places in RedisSentinelFactory

* nits

* fix test logging on error

1) it takes a lot of time now, so needs larger timeout
2) docker logs can be large, so need to increase maxBuffer size so doesn't error (and break test clean up)

* invalidate watches when client reconnects

+ provide API for other wrapper clients to also create invalid watch states programatically.

Reasoning: if a user does a WATCH and then the client reconnects, the watch is no longer active, but if a user does a MULTI/EXEC after that, they wont know, and since the WATCH is no longer active, the request has no protection.

The API is needed for when a wrapper client (say sentinel, cluster) might close the underlying client and reopen a new one transparently to the user.  Just like in the reconnection case, this should result in an error, but its up to the wrapping client to provide the appropriate error

* remove WATCH and UNWATCH command files, fix WATCH and UNWATCH return type, some more cleanups

* missing file in last commit :P

* support for custom message in `WatchError`

* setDirtyWatch

* update watch docs

* fixes needed

* wip

* get functions/modules to work again

self -> _self change

* reuse leased client on pipelined commands.

though I realize this implementation, really only works after the first write command.

unsure this is worth it.

* test tweaks

* nit

* change how "sentinel" object client works, allow it to be reserved

no more semaphore type counting

* review

* fixes to get more tests to pass

* handle dirtyWatch and watchEpoch in reset and resetIfDirty

* "fix", but not correct, needs more work

* fix pubsub proxy

* remove timeout from steadyState function in test, caused problems

* improve restarting nodes

* fix pubsub proxy and test

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2024-02-05 09:48:33 -05:00
97463e9dcc chain pipeline commands 2024-01-17 15:30:01 -05:00
520441704b fix multi "generic" type, some docs 2023-11-20 13:15:40 -05:00
7247777a6f a little bit docs 2023-11-09 21:01:26 -05:00
a5a4cb45ea wip 2023-11-09 11:12:41 -05:00
98970fab2e FT.CURSOR READ 2023-11-06 14:06:54 -05:00
817818aa91 WIP 2023-10-23 15:05:16 -04:00
7b4d12bdb3 FUNCTION STATS migration guide 2023-10-02 14:13:35 -04:00
4be30ccd0f comment cluster request & response policies (keep v4 behaver) 2023-09-18 17:16:41 -04:00
292dc58e15 cluster v4-to-v5 2023-09-12 16:03:29 -04:00
c12dc79950 RedisJSON 2023-09-05 18:19:31 -04:00
3895eb5926 client pool 2023-09-04 17:26:48 -04:00
c7a03acfd3 todo.md 2023-08-01 16:24:13 -04:00
d0801921e7 JSON.STRAPPEND 2023-08-01 14:52:08 -04:00
fd016ee1b2 some json and search commands 2023-08-01 14:29:34 -04:00
cf38f512b8 some RediSearch commands 2023-07-31 17:34:45 -04:00
ff07bbf3d3 WIP 2023-07-27 11:23:34 -04:00
fdd1978d92 WIP 2023-07-18 16:32:45 -04:00
384f6ca78f graph docs 2023-07-10 12:23:14 -04:00
9915d67510 Merge branch 'v5' of https://github.com/leibale/node-redis into v5 2023-07-06 15:51:44 -04:00
d986ff52b6 FT.SUGDEL docs 2023-07-06 15:50:21 -04:00
172d329234 fix scan iterators 2023-07-06 11:37:56 -04:00
6ca420f15e fix #2561 2023-07-06 11:07:52 -04:00
2dd1f2ca38 bloom module 2023-07-05 15:22:33 -04:00
ea2d9d2a77 stream commands + some more 2023-06-28 11:40:55 -04:00
e95634b375 ref #2489 2023-06-22 19:41:35 -04:00
6059b1edd8 Merge branch 'v5' of github.com:leibale/node-redis into v5 2023-06-22 18:33:45 -04:00
2b318d4100 WIP 2023-06-22 18:18:23 -04:00
b46f08228c wip 2023-06-21 19:09:45 -04:00
4894c26458 wip 2023-06-20 20:04:05 -04:00
de53b96ba6 Merge branch 'master' of github.com:redis/node-redis into v5 2023-06-19 18:11:46 -04:00
9c1f2a0f86 restore programmability docs 2023-06-19 17:13:19 -04:00
c188a5c781 docs
Co-authored-by: Guy Royse <guy@guyroyse.com>
2023-06-14 15:01:52 -04:00
9795690364 docs 2023-06-08 07:17:42 -04:00
cf79a806c5 WIP 2023-06-07 11:45:48 -04:00
eb47bb03fc some docs
Co-authored-by: Guy Royse <guy@guyroyse.com>
2023-06-07 11:32:15 -04:00
8ef0e47e57 RESP docs 2023-06-01 12:39:59 +03:00
fcb3a011b5 cluster multi 2023-05-30 19:23:14 +03:00
454617bf83 Add a note about multiple Pub/Sub channel listeners (#2433)
* Add multiple listener language to pub/sub docks

Clarify that multiple subscriptions create multiple listeners.

* Update pub-sub.md

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2023-05-29 09:04:30 -04:00
100a5232ac use setImmediate instead of queueMicrotask (to improve performance) (#2516) 2023-05-29 09:01:22 -04:00
e3326134ba deprecate QUIT and disconnect, implement close and destroy 2023-05-15 15:41:40 +03:00
f8fa8878c3 fix some more 2023-05-14 14:54:09 +03:00
13f1fa9e58 WIP 2023-05-10 14:55:03 +03:00
d59254e497 some commands 2023-05-09 14:04:26 +03:00