Use `redis.createClient` rather than the RedisClient constructor
See original GitHub issueIt’s a bit confusing that we are using the RedisClient constructor directly, as all of the docs (including options) for node_redis are around redis.createClient
. Because of this, there is at least one discrepancy with passing connection options to redis. According to current node_redis docs here, the client should be able to specify a url
option rather than passing host
and port
options through the connection hash that you pass through to node_redis
. However, the RedisClient
constructor does not support a url
property. The url
property is normalized and split into host
and port
properties through a call here, which dives into lib/createClient.js
and parsed into host
and port
here. Passing the url
option through options.connection
in RedisPubSub
constructor causes an attempted connection to redis://127.0.0.1:6379
, regardless of what is passed via url
. Because of this discrepancy, and for the sake of developer sanity, I think it makes more sense to interact with the publicly documented API of node_redis
(aka, redis.createClient(options: Object)
rather than interface with the RedisClient
constructor directly as it fits more inline with the node_redis
docs and this lib provides a passthrough via options.connection
which will be assumed to follow the node_redis
publicly doc’d API. I am willing to put in a PR to make this switch later this week.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
@thebigredgeek Ah darn.
ioredis
is still hard coded.@youngboy Just published 1.1.4