Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Update Redis ascoltatori to use pub_conn instead of client_conn #161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/redis_ascoltatore.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ RedisAscoltatore.prototype = Object.create(AbstractAscoltatore.prototype);
RedisAscoltatore.prototype._startPub = function() {
var that = this;
if (this._client === undefined) {
this._client = createConn(this._opts, 'client_conn');
this._client = createConn(this._opts, 'pub_conn');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please make this backward compatible?

this._client.on("ready", function() {
debug("created pub connection");
that._updateReady("_ready_pub");
Expand Down Expand Up @@ -118,7 +118,7 @@ RedisAscoltatore.prototype._startSub = function() {
topic = that._recvTopic(topic);

payload = msgpack.decode(payload);

if (ascoltatore) {
ascoltatore.publish(topic, payload.message, payload.options);
} else {
Expand Down Expand Up @@ -199,7 +199,7 @@ RedisAscoltatore.prototype.publish = function publish(topic, message, options, d
if (!topic.match(new RegExp('/$'))) {
topic += '/';
}

this._client.publish(topic, msgpack.encode(payload), function() {
debug("new message published to " + topic);
defer(done);
Expand Down
2 changes: 1 addition & 1 deletion test/redis_ascoltatore_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describeAscoltatore("redis", function() {
it('should get the redis client for publish already created', function(done) {
var opts = redisSettings();
var initialConnection = new Redis(opts);
opts.client_conn = initialConnection;
opts.pub_conn = initialConnection;
var that = this;
that.instance = new ascoltatori.RedisAscoltatore(opts);
that.instance.subscribe("hello", wrap(done), function() {
Expand Down