Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: redis/ioredis
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.19.4
Choose a base ref
...
head repository: redis/ioredis
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.19.5
Choose a head ref
  • 5 commits
  • 7 files changed
  • 5 contributors

Commits on Dec 23, 2020

  1. docs(README): update failover docs for AWS ElastiCache (#1260)

    The reconnectOnError handler doesn't necessarily execute on newer configurations of AWS ElastiCache, particularly those with auto-failover enabled
    laupow authored Dec 23, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    69cdc67 View commit details

Commits on Dec 28, 2020

  1. chore: adjust stale settings

    luin authored Dec 28, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    72bde8f View commit details

Commits on Jan 14, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    be5d53f View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    37c6daf View commit details
  3. chore(release): 4.19.5 [skip ci]

    ## [4.19.5](v4.19.4...v4.19.5) (2021-01-14)
    
    ### Bug Fixes
    
    * password contains colons ([#1274](#1274)) ([37c6daf](37c6daf))
    semantic-release-bot committed Jan 14, 2021
    Copy the full SHA
    c7d80a7 View commit details
Showing with 37 additions and 9 deletions.
  1. +3 −1 .github/stale.yml
  2. +7 −0 Changelog.md
  3. +5 −4 README.md
  4. +2 −2 lib/utils/index.ts
  5. +1 −1 package-lock.json
  6. +1 −1 package.json
  7. +18 −0 test/unit/utils.ts
4 changes: 3 additions & 1 deletion .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
daysUntilStale: 30
daysUntilStale: 365
daysUntilClose: 7
exemptLabels:
- pinned
- security
- bug
- discussion
staleLabel: wontfix
markComment: >
This issue has been automatically marked as stale because it has not had
7 changes: 7 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [4.19.5](https://github.com/luin/ioredis/compare/v4.19.4...v4.19.5) (2021-01-14)


### Bug Fixes

* password contains colons ([#1274](https://github.com/luin/ioredis/issues/1274)) ([37c6daf](https://github.com/luin/ioredis/commit/37c6dafafd51d817a3dfe4b4ca722fb709a209e7))

## [4.19.4](https://github.com/luin/ioredis/compare/v4.19.3...v4.19.4) (2020-12-13)


9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -204,7 +204,7 @@ redis.getBuffer("foo", (err, result) => {
## Pipelining

If you want to send a batch of commands (e.g. > 5), you can use pipelining to queue
the commands in memory and then send them to Redis all at once. This way the performance improves by 50%~300% (See [benchmark section](#benchmark)).
the commands in memory and then send them to Redis all at once. This way the performance improves by 50%~300% (See [benchmark section](#benchmarks)).

`redis.pipeline()` creates a `Pipeline` instance. You can call any Redis
commands on it just like the `Redis` instance. The commands are queued in memory
@@ -662,7 +662,7 @@ Set maxRetriesPerRequest to `null` to disable this behavior, and every command w

### Reconnect on error

Besides auto-reconnect when the connection is closed, ioredis supports reconnecting on the specified errors by the `reconnectOnError` option. Here's an example that will reconnect when receiving `READONLY` error:
Besides auto-reconnect when the connection is closed, ioredis supports reconnecting on certain Redis errors using the `reconnectOnError` option. Here's an example that will reconnect when receiving `READONLY` error:

```javascript
const redis = new Redis({
@@ -676,9 +676,10 @@ const redis = new Redis({
});
```

This feature is useful when using Amazon ElastiCache. Once failover happens, Amazon ElastiCache will switch the master we currently connected with to a slave, leading to the following writes fails with the error `READONLY`. Using `reconnectOnError`, we can force the connection to reconnect on this error in order to connect to the new master.
This feature is useful when using Amazon ElastiCache instances with Auto-failover disabled. On these instances, test your `reconnectOnError` handler by manually promoting the replica node to the primary role using the AWS console. The following writes fail with the error `READONLY`. Using `reconnectOnError`, we can force the connection to reconnect on this error in order to connect to the new master. Furthermore, if the `reconnectOnError` returns `2`, ioredis will resend the failed command after reconnecting.

On ElastiCache insances with Auto-failover enabled, `reconnectOnError` does not execute. Instead of returning a Redis error, AWS closes all connections to the master endpoint until the new primary node is ready. ioredis reconnects via `retryStrategy` instead of `reconnectOnError` after about a minute. On ElastiCache insances with Auto-failover enabled, test failover events with the `Failover primary` option in the AWS console.

Furthermore, if the `reconnectOnError` returns `2`, ioredis will resend the failed command after reconnecting.

## Connection Events

4 changes: 2 additions & 2 deletions lib/utils/index.ts
Original file line number Diff line number Diff line change
@@ -257,8 +257,8 @@ export function parseURL(url) {

const result: any = {};
if (parsed.auth) {
const parsedAuth = parsed.auth.split(":");
result.password = parsedAuth[1];
const index = parsed.auth.indexOf(":")
result.password = index === -1 ? '' : parsed.auth.slice(index + 1)
}
if (parsed.pathname) {
if (parsed.protocol === "redis:" || parsed.protocol === "rediss:") {
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ioredis",
"version": "4.19.4",
"version": "4.19.5",
"description": "A robust, performance-focused and full-featured Redis client for Node.js.",
"main": "built/index.js",
"files": [
18 changes: 18 additions & 0 deletions test/unit/utils.ts
Original file line number Diff line number Diff line change
@@ -195,6 +195,24 @@ describe("utils", function () {
password: "pass",
key: "value",
});
expect(
utils.parseURL("redis://user:pass:word@127.0.0.1:6380/4?key=value")
).to.eql({
host: "127.0.0.1",
port: "6380",
db: "4",
password: "pass:word",
key: "value",
});
expect(
utils.parseURL("redis://user@127.0.0.1:6380/4?key=value")
).to.eql({
host: "127.0.0.1",
port: "6380",
db: "4",
password: "",
key: "value",
});
expect(utils.parseURL("redis://127.0.0.1/")).to.eql({
host: "127.0.0.1",
});