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

fix(query-orchestrator): use bluebird to promisify redis client #85

Closed
wants to merge 1 commit into from

Conversation

vladi-dev
Copy link
Contributor

fixes #84

@paveltiunov
Copy link
Member

Hey @vladi-dev ! Thanks for providing this PR! I believe bluebird fixes your original issue. On other hand bluebird will replace/patch native Promise implementation which entails other similar issues that you faced already. I believe it's better just not to use any promisifyAll stuff here and make async methods manually one by one as list of those used methods is known.

@vladi-dev
Copy link
Contributor Author

@paveltiunov do you mean having something like this?

const { promisify } = require('util');
['brpop', 'del', 'exec', 'get', 'hget', 'rpop', 'set', 'zadd', 'zrange', 'zrangebyscore'].forEach(
  k => promisify(redis.RedisClient.prototype[k])
);
promisify(redis.Multi.prototype.exec);

@paveltiunov
Copy link
Member

@vladi-dev Yep. Exactly! Probably it also makes sense to promisify instances and not prototypes to avoid side effects.

@vladi-dev
Copy link
Contributor Author

@paveltiunov please take a look at #89

@vladi-dev
Copy link
Contributor Author

Implemented manual promisify in #89

@vladi-dev vladi-dev closed this Apr 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RedisQueueDriver mutates EventEmitter prototype indirectly
2 participants