-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Improve cluster connection pool logic when disconnecting (#5)
* Tell Redis cluster to disable protected mode before running tests Signed-off-by: Martin Slota <[email protected]> * Try to enable Redis cluster tests on CI Signed-off-by: Martin Slota <[email protected]> * Add a failing test around Redis cluster disconnection logic Signed-off-by: Martin Slota <[email protected]> * Rename function parameter Signed-off-by: Martin Slota <[email protected]> * Turn node error listener into an arrow function so that points to the connection pool instance Signed-off-by: Martin Slota <[email protected]> * Extract node listeners into separate constants Signed-off-by: Martin Slota <[email protected]> * Keep track of listeners along with each Redis client Signed-off-by: Martin Slota <[email protected]> * Remove node listeners when the node is being removed Signed-off-by: Martin Slota <[email protected]> * Emit node removal events whenever a node is removed Signed-off-by: Martin Slota <[email protected]> * When resetting, add nodes before removing old ones Signed-off-by: Martin Slota <[email protected]> * Rename Node type to NodeRecord for clarity Signed-off-by: Martin Slota <[email protected]> * Also rename the field holding node records Signed-off-by: Martin Slota <[email protected]> * Rename variable to nodeRecord Signed-off-by: Martin Slota <[email protected]> * Rename another variable to nodeRecord Signed-off-by: Martin Slota <[email protected]> * Fix a reference to connection pool nodes Signed-off-by: Martin Slota <[email protected]> * Do not fail when retrieving a node by non-existing key Signed-off-by: Martin Slota <[email protected]> * Revert "Fix a reference to connection pool nodes" This reverts commit 6536e22. Signed-off-by: Martin Slota <[email protected]> * Fix a reference to connection pool nodes, this time a bit more correctly Signed-off-by: Martin Slota <[email protected]> * Add a valid slots table to mock server in tests that expect to be able to connect using the Cluster client Signed-off-by: Martin Slota <[email protected]> * Do not assume that node removal will occur *after* refreshSlotsCache() is finished Signed-off-by: Martin Slota <[email protected]> --------- Signed-off-by: Martin Slota <[email protected]>
- Loading branch information
1 parent
11b3cbb
commit 2733aee
Showing
8 changed files
with
129 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,16 @@ | ||
docker run -e "INITIAL_PORT=30000" -e "IP=0.0.0.0" -p 30000-30005:30000-30005 grokzen/redis-cluster:latest & | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
docker run --rm --name redis-cluster-ioredis-test -e "INITIAL_PORT=30000" -e "IP=0.0.0.0" -p 30000-30005:30000-30005 grokzen/redis-cluster:latest & | ||
trap 'docker stop redis-cluster-ioredis-test' EXIT | ||
|
||
npm install | ||
|
||
sleep 15 | ||
|
||
for port in {30000..30005}; do | ||
docker exec redis-cluster-ioredis-test /bin/bash -c "redis-cli -p $port CONFIG SET protected-mode no" | ||
done | ||
|
||
npm run test:js:cluster || npm run test:js:cluster || npm run test:js:cluster |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters