1
0
mirror of https://github.com/redis/node-redis.git synced 2025-07-31 05:44:24 +03:00

2295 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
2eaaa58736 add addscores to aggregate search command (v5) (#2818) 2024-10-11 11:24:27 +03:00
f7d824c07c CAE-193: add "IGNORE" options to time series commands (for v5 branch) (#2753)
* CAE-193: add "IGNORE" options to time series commands (for v5 branch)

* add INCR/DECR and modify tests to not test ignore on older version

* require maxTimeDiff/maxValDiff to be specified

also rename them

* fix add/ignore test after api change

* update tests for api change in IGNORE option
2024-10-11 11:22:31 +03:00
949b944b0f fix FIRST_KEY_INDEX for FT.SUG* commands 2024-07-01 16:09:07 -04:00
4452117946 clientKillMaxAge typo, replace MANAGE by MAXAGE (#2782)
Co-authored-by: “gianDiazM” <“gian.diaz.marquez@gmail.com”>
2024-07-01 09:08:22 -04:00
85d5bf4125 add CLIENT KILL MAXAGE (v5) (#2760)
* add CLIENT KILL MANAGE maxAge (v5)

* replace "MANAGE" with "MAXAGE"

* fix test

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2024-06-18 10:01:41 -04:00
271baf3a65 HSCAN NOVALUES support (v5) (#2758)
* HSCAN VALUES support (v5)

* add hscanNoValuesIterator

* nitpick

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2024-06-03 10:16:07 -04: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
88ef3b87ed exclude ./lib/sentinel/test-util.ts from build 2024-02-28 10:26:23 -05:00
3e167912fb More fixes for socket issue (#2710)
* more typing fixes

* try to redo typing a bit and genericize to make better

* use genericized cluster options for cluster as well
2024-02-21 10:29:24 +02:00
7e27f72f72 Update README.md 2024-02-19 13:28:47 -08:00
06ba713706 copy #2628 into v5 2024-02-19 13:26:59 -08: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
2309d09ca1 fix socket type issues 2024-02-15 09:57:25 -05:00
cc85112e54 remove console.log 2024-02-12 18:38:18 -05:00
65eb69a787 fix legacy client command functions - do not return "empty" promise 2024-02-12 18:38:09 -05:00
77ecdf2721 fix #2679 - fix socket types, and clean some code 2024-02-12 18:38:00 -05:00
ec33759e8a Merge branch 'master' of github.com:redis/node-redis into v5 2024-02-05 11:26:19 -05:00
8340a9e830 some cleanups 2024-02-05 11:18:27 -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
dbf8f59a47 Release redis@4.6.13 redis@4.6.13 2024-02-05 09:26:12 -05:00
b6a31dd71f upgrade @redis/client 2024-02-05 09:25:14 -05:00
03ab4fbd6c Release client@1.5.14 client@1.5.14 2024-02-05 09:24:20 -05:00
0f29f4238f Change json docker version to 2.6.9 2024-02-05 09:14:24 -05:00
0cd6915698 fix client.reset 2024-01-31 15:07:01 -05:00
baef3486ad fix client.reset 2024-01-31 13:23:26 -05:00
1006e3b29f fix dirty selected DB check 2024-01-29 08:29:55 -05:00
f7f51b9c92 fix pubsub handler 2024-01-29 08:02:54 -05:00
295647cf9d fix(clustered pubsub): check that client.isOpen before calling client.disconnect() when unsubscribing (#2687)
* Confirm the client isOpen before disconnecting

* Write tests

* fix tests

* fix tests

---------

Co-authored-by: Leibale Eidelman <me@leibale.com>
2024-01-29 00:25:26 -08:00
dded3de090 fix monitor, add client.reset & client.resetState, some fixes 2024-01-24 12:28:30 -05:00
c2747dea1c Merge branch 'v5' of github.com:leibale/node-redis into v5 2024-01-24 03:31:17 -05:00
455939c775 fix pubsub listener type 2024-01-17 18:33:46 -05:00
97463e9dcc chain pipeline commands 2024-01-17 15:30:01 -05:00
0f188a4eec make cluster.connect() return this 2024-01-16 15:16:51 -05:00
c1fc0feed0 #2670 #2668 - add note about command modifiers that changes the reply type 2024-01-03 11:46:09 -05:00
5a96058c2f Linking to Redis learning resources (#2628) 2023-12-20 12:32:49 +02:00
6686f44d3b move from TypeScript privates to "#" 2023-12-18 17:03:21 -05:00
d1f50df192 improve decoder tests coverage, use actual private ("#") instead of TypeScript private 2023-12-18 16:00:19 -05:00
ccd9610177 Release redis@4.6.12 redis@4.6.12 2023-12-18 15:20:52 -05:00
55d07d2767 upgrade @redis/client 2023-12-18 15:20:16 -05:00
bb6f14cf7e Release client@1.5.13 client@1.5.13 2023-12-18 15:18:29 -05:00
f4680f0849 fix #2665 - handle errors in multi/pipeline replies (#2666)
* fix #2665 - handle errors in multi/pipeline replies

* fix MultiErrorReply replies type

* run tests on all versions, remove console.log, fix bug

* add errors iterator helper

* test `.errors()` as well
2023-12-18 15:15:21 -05:00
f3631f8e73 improve decoder coverage + fix some bugs 2023-12-13 12:27:29 -05:00
c56f628cf8 remove .only 2023-12-12 17:02:21 -05:00
9a9c9a6379 Merge branch 'master' of github.com:redis/node-redis into v5 2023-12-12 16:27:11 -05:00
94cb86f605 test RESP decoder + fix some bugs 2023-12-12 16:15:50 -05:00
7f7a53a1b1 uncomment some tests, fix bugs with _selectedDB 2023-12-07 09:42:04 -05:00
3b28aa6c81 add errors iterator to MultiErrorReply 2023-12-07 09:01:43 -05:00