redis 2.6.4 → 2.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/changelog.md +7 -0
  2. package/index.js +11 -4
  3. package/package.json +1 -1
package/changelog.md CHANGED
@@ -1,6 +1,13 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## v.2.6.5 - 15 Jan, 2017
5
+
6
+ Bugfixes
7
+
8
+ - Fixed parser not being reset in case the redis connection closed ASAP for overcoming of output buffer limits
9
+ - Fixed parser reset if (p)message_buffer listener is attached
10
+
4
11
  ## v.2.6.4 - 12 Jan, 2017
5
12
 
6
13
  Bugfixes
package/index.js CHANGED
@@ -156,8 +156,6 @@ function RedisClient (options, stream) {
156
156
  this.buffers = options.return_buffers || options.detect_buffers;
157
157
  this.options = options;
158
158
  this.reply = 'ON'; // Returning replies is the default
159
- // Init parser
160
- this.reply_parser = create_parser(this);
161
159
  this.create_stream();
162
160
  // The listeners will not be attached right away, so let's print the deprecation message while the listener is attached
163
161
  this.on('newListener', function (event) {
@@ -171,10 +169,16 @@ function RedisClient (options, stream) {
171
169
  'The drain event listener is deprecated and will be removed in v.3.0.0.\n' +
172
170
  'If you want to keep on listening to this event please listen to the stream drain event directly.'
173
171
  );
174
- } else if (event === 'message_buffer' || event === 'pmessage_buffer' || event === 'messageBuffer' || event === 'pmessageBuffer' && !this.buffers) {
172
+ } else if ((event === 'message_buffer' || event === 'pmessage_buffer' || event === 'messageBuffer' || event === 'pmessageBuffer') && !this.buffers && !this.message_buffers) {
173
+ if (this.reply_parser.name !== 'javascript') {
174
+ return this.warn(
175
+ 'You attached the ' + event + ' without the hiredis parser without the returnBuffers option set to true.\n' +
176
+ 'Please use the JavaScript parser or set the returnBuffers option to true to return buffers.'
177
+ );
178
+ }
179
+ this.reply_parser.optionReturnBuffers = true;
175
180
  this.message_buffers = true;
176
181
  this.handle_reply = handle_detect_buffers_reply;
177
- this.reply_parser = create_parser(this);
178
182
  }
179
183
  });
180
184
  }
@@ -224,6 +228,9 @@ function create_parser (self) {
224
228
  RedisClient.prototype.create_stream = function () {
225
229
  var self = this;
226
230
 
231
+ // Init parser
232
+ this.reply_parser = create_parser(this);
233
+
227
234
  if (this.options.stream) {
228
235
  // Only add the listeners once in case of a reconnect try (that won't work)
229
236
  if (this.stream) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redis",
3
- "version": "2.6.4",
3
+ "version": "2.6.5",
4
4
  "description": "Redis client library",
5
5
  "keywords": [
6
6
  "database",