1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00

91 Commits

Author SHA1 Message Date
Charles Feng
ef1a90642d Regenerate commands.js for redis 2.8.9. 2014-04-23 14:52:17 -07:00
Marek
656ecbbbf4 Regenerate commands.js to match redis 2.8.0. Adds support for 'config rewrite', 'pubsub', 'scan', 'sscan', 'hscan' and 'zscan' 2013-12-15 16:01:33 +00:00
Bryce Baril
92ed0befc1 In nested MULTIBULK buffers, correctly recurse on an incomplete read buffer.
Signed-off-by: DTrejo <david.daniel.trejo@gmail.com>
2013-03-09 19:27:33 -05:00
Bryce Baril
9127f34393 Parser should only catch parser errors and bubble the rest to the caller.
Signed-off-by: DTrejo <david.daniel.trejo@gmail.com>
2013-03-09 19:27:33 -05:00
Bryce Baril
0c172f425c Fix parser incorrect buffer skip for MULTI/EXEC transaction errors with WATCH.
Signed-off-by: DTrejo <david.daniel.trejo@gmail.com>
2013-03-09 19:27:33 -05:00
DTrejo
bd1e004e99 regenerate lib/commands.js 2013-02-17 19:06:13 -05:00
Matt Ranney
f367b8a03c Another version bump because 0.8.1 didn't get applied properly for some mysterious reason.
Sorry about that.

Changed name of "faster" parser to "javascript".
2012-11-02 14:17:53 -07:00
Michael Jackson
7f3f11f9b1 Make return_buffers work with ints 2012-10-26 20:35:19 -07:00
Luigi Pinca
f03e673338 Fix cases where the offset is out of range (javascript parser)
The exception for the "too far" error was not thrown if the offset was bigger
than the buffer length, screwing up the parser. Fix #277

Signed-off-by: DTrejo <david.trejo@voxer.com>
2012-09-21 20:52:58 -04:00
Jerry Sievert
1dbe587fca remove null for rewind and use throw mechanism, should help with #273
Fix #275

Signed-off-by: DTrejo <david.trejo@voxer.com>
2012-09-21 20:48:31 -04:00
Jerry Sievert
668dfdead6 fix null key response: issue #267 2012-09-11 11:43:18 -07:00
Matt Ranney
670c256e35 Whitespace and other JSHint changes. 2012-09-10 22:50:54 -07:00
Matt Ranney
63f4f5cdf2 Merge pull request #242 from JerrySievert/master
a generally faster javascript parser
2012-09-10 22:32:15 -07:00
Jerry Sievert
3d27cb23ee update for style changes 2012-08-23 13:09:05 -07:00
Jerry Sievert
8be55fb304 fix all but lrange 20k 2012-08-22 21:53:18 -07:00
DTrejo
f3ee8eabd8 commands.js regenerated 2012-08-06 15:05:25 -07:00
Jerry Sievert
34568a4bb3 added fallback if missing Buffer.concat() 2012-07-08 14:54:48 -07:00
Jerry Sievert
8d0f2e7239 some microbenchmark updates, slight speed improvement 2012-07-08 08:32:33 -07:00
Jerry Sievert
4048349115 some cleanup and comments 2012-07-08 05:16:36 -07:00
Jerry Sievert
7ec1815188 generally faster javascript parser 2012-07-07 02:44:51 -07:00
Matt Ranney
bf806a0be3 Better util/sys fallback with try/catch instead of version magic. 2011-11-16 10:57:02 -10:00
Zachary Scott
c83c285213 remove double 'util' and 'Queue' from requires
ex: require('./lib/util').util;
2011-11-16 10:37:38 -10:00
Matt Ranney
16c79f0d18 Merge pull request #139 from felixge/master
Fix: Hiredis parser traps pubsub event exceptions
2011-11-13 20:23:23 -08:00
Matt Ranney
2fa2ffc438 Remove reference to arguments which was unused and de-optimizes the constructor. 2011-11-13 18:12:53 -10:00
Matt Ranney
0c8646bc61 Use number literals for case labels to help V8 go faster. 2011-11-13 18:12:28 -10:00
Matt Ranney
8e338c6136 node 0.6 fixes 2011-11-10 13:05:46 -10:00
Felix Geisendörfer
fbc1642461 Fix: Hiredis parser traps pubsub event exceptions
While using this module with the hiredis parser, I noticed that exceptions
thrown inside of subscribe/message/etc. callbacks would be reported as
parser error exceptions, which was confusing.

Example:

```
var client = require('./index').createClient();

client.on('subscribe', function() {
  throw new Error('My Error');
});
client.subscribe('channel');
```
I would expect the above to throw 'My Error' as a simple exception, however,
when using the hiredis parser I get:

```
events.js:45
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: Redis reply parser error: Error: My Error
    at RedisClient.<anonymous> (/Users/felix/code/node_redis/hiredis.js:4:9)
    at RedisClient.emit (events.js:67:17)
    at RedisClient.return_reply (/Users/felix/code/node_redis/index.js:457:22)
    at HiredisReplyParser.<anonymous> (/Users/felix/code/node_redis/index.js:220:14)
    at HiredisReplyParser.emit (events.js:64:17)
    at HiredisReplyParser.execute (/Users/felix/code/node_redis/lib/parser/hiredis.js:35:22)
    at RedisClient.on_data (/Users/felix/code/node_redis/index.js:365:27)
    at Socket.<anonymous> (/Users/felix/code/node_redis/index.js:58:14)
    ...
```

The attached patch fixes this problem by changing the way the HiredisReplyParser
traps exceptions, and also provides a unit test for it.

Please let me know if you need any tweaks on the patch for landing it, I was
not quite sure where to put my test / how to structure it, since most test
cases seem to be integration tests at this point.

Also, if you would prefer an integration test for this, here you go:

``` javascript
var client = require('./index').createClient();
var assert = require('assert');

process.on('uncaughtException', function listener(err) {
  process.removeListener('uncaughtException', listener);

  // Drop the stack, otherwise the assert gets trapped by node
  process.nextTick(function() {
    assert.ok(!/parser error/.test(err.message), err.message);
    client.quit();
  });
});

client.on('subscribe', function() {
  throw new Error('My Error');
});
client.subscribe('channel');
```

PS: If you wonder why this only affects pubsub events: This is because
RedisClient#return_reply does exception trapping differently for events than
it does for callbacks.

See: 3e95c55a03/index.js (L431)
Vs: 3e95c55a03/index.js (L447)
2011-10-17 11:07:11 +02:00
Matt Ranney
f9e17556d2 Performance improvements and backpressure controls.
Simply and speed up command argument processing logic.
Commands now return the true/false value from the underlying socket write(s).
Implement command_queue high water and low water for more better control of queueing.
2011-06-30 14:12:35 -06:00
Matt Ranney
707c9ab3df Add static list of commands to those downloaded from redis.io. 2011-06-28 22:48:30 -07:00
Matt Ranney
3d36711563 Auto update of new commands from redis.io (Dave Hoover)
Run this: node generate_commands.js

To fetch redis.io/commands.json and save it to a file that node_redis will read at startup.
2011-06-12 14:25:57 -10:00
Dave Hoover
e6b29c6846 Simplifying writeCommandsToFile /ht @polgfred 2011-06-02 21:52:03 -05:00
Dave Hoover
e210755b52 Developing the 'somehow' in 'This list [of commands] needs to be updated, and perhaps auto-updated somehow' 2011-06-02 21:12:13 -05:00
Matt Ranney
f10ff9e916 Lots of bugs fixed.
*  connection error did not properly trigger reconnection logic [GH-85]
*  client.hmget(key, [val1, val2]) was not expanding properly [GH-66]
*  client.quit() while in pub/sub mode would throw an error [GH-87]
*  client.multi(['hmset', 'key', {foo: 'bar'}]) fails [GH-92]
2011-04-21 16:48:14 -10:00
Matt Ranney
aa3cefe506 Allocate new Arrays with known size instead of dynamically growing them. 2010-12-13 15:55:30 -08:00
Matt Ranney
202df58b93 Re-throw callback errors on nextTick
Otherwise an error thrown in a callback would be throw on the parser's stack.
2010-12-13 12:46:54 -08:00
Matt Ranney
36c40ee03d JavaScript parser passes all tests when returning strings.
JS is still way too slow for large mb replies.  Hiredis is fast for strings of large  replies,
but slow for buffers.
2010-12-07 00:23:31 -08:00
Matt Ranney
b907364573 Support for multiple reply parsers including hiredis.
Several parsing bugs fixed in JavaScript.
Some new config options that need to be better documented.
2010-12-06 09:11:16 -08:00
Pieter Noordhuis
a5381964d9 Add option to specify whether to return strings or buffers for bulk data 2010-11-30 23:10:02 +01:00
Pieter Noordhuis
4bef57cff0 Try to use hiredis as default reply parser 2010-11-30 22:40:09 +01:00
Pieter Noordhuis
1e698e3fce Move the reply parser to its own file 2010-11-30 22:29:16 +01:00
Pieter Noordhuis
88711fe4fe Move requiring util to a separate file 2010-11-30 22:19:24 +01:00