Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle possible unhandled promise rejection with autopipelining+cluster #1467

Merged
merged 1 commit into from
Nov 23, 2021

Conversation

TysonAndre
Copy link
Collaborator

Deliberately add asCallback on the same Promise instance being returned,
not on a different Promise instance that resolves to the same thing.

Avoid this category of unhandledRejection errors:

process.on('unhandledRejection', (reason) => console.log('unhandledRejection', reason));
const x = Promise.reject(new Error());
x.catch((e) => console.log('caught x', e));

const causesUnhandledRejection = Promise.resolve().then(() => x);

Related to #1466

Deliberately add `asCallback` on the **same** Promise instance being returned,
not on a different Promise instance that resolves to the same thing.

Avoid this error:

```javascript
process.on('unhandledRejection', (reason) => console.log('unhandledRejection', reason));
const x = Promise.reject(new Error());
x.catch((e) => console.log('caught x', e));

const causesUnhandledRejection = Promise.resolve().then(() => x);
```

Related to redis#1466
@TysonAndre TysonAndre force-pushed the autopipelining-cluster-asCallback branch from 3acf1e8 to 47394d0 Compare November 23, 2021 01:08
@luin luin merged commit 6ad285a into redis:master Nov 23, 2021
ioredis-robot pushed a commit that referenced this pull request Nov 23, 2021
## [4.28.1](v4.28.0...v4.28.1) (2021-11-23)

### Bug Fixes

* handle possible unhandled promise rejection with autopipelining+cluster ([#1467](#1467)) ([6ad285a](6ad285a)), closes [#1466](#1466)
@ioredis-robot
Copy link
Collaborator

🎉 This PR is included in version 4.28.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

janus-dev87 added a commit to janus-dev87/ioredis-work that referenced this pull request Mar 1, 2024
## [4.28.1](redis/ioredis@v4.28.0...v4.28.1) (2021-11-23)

### Bug Fixes

* handle possible unhandled promise rejection with autopipelining+cluster ([#1467](redis/ioredis#1467)) ([6ad285a](redis/ioredis@6ad285a)), closes [#1466](redis/ioredis#1466)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants