1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00
Commit Graph

1703 Commits

Author SHA1 Message Date
Matt Ranney
5834f63dd3 Fix month in changelog. 2011-11-14 23:37:45 -10:00
Matt Ranney
ff9ac4bf34 Add eval example. 2011-11-14 20:43:32 -10:00
Matt Ranney
a4e8c748df Changes for v0.7.0. v0.7.0 2011-11-14 20:41:38 -10:00
Matt Ranney
ed44b8f702 Bump version. 2011-11-14 20:23:22 -10:00
Matt Ranney
29c408cbf1 Update TODO comment for retry thresholds. 2011-11-14 20:23:11 -10:00
Matt Ranney
dfd4c51b79 Merge pull request #136 from bobrik/callback-fixes
added ability to pass undefined instead of callback
2011-11-14 22:15:36 -08:00
Matt Ranney
90aa21936c Update TODO comment 2011-11-14 20:14:49 -10:00
Matt Ranney
8d0457f2c3 Add test for monitor command. 2011-11-13 21:18:12 -10:00
Matt Ranney
719c606b78 Fix test for optional subscribe callback. 2011-11-13 21:03:32 -10:00
Matt Ranney
6232d35993 Subscribe commands take optional callback. Fixes [GH-140]. 2011-11-13 21:01:15 -10:00
Matt Ranney
6a44331acd Fix this/self reference on db re-select. 2011-11-13 20:19:34 -10:00
Matt Ranney
dfcfaf3dc5 Fix style. 2011-11-13 20:12:22 -10:00
Matt Ranney
82cc930bc7 Merge pull request #142 from oxys/master
After a connection error, selected db, if it was set, is not restored
2011-11-13 21:57:32 -08:00
Matt Ranney
6e38f4d6e0 Merge pull request #146 from maks/master
added sort example
2011-11-13 21:09:25 -08: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
abd32ce407 Add metrics to devDependencies. 2011-11-13 18:20:00 -10:00
Matt Ranney
66a32f86dc new version of multi_bench that tests more realistic scenarios. 2011-11-13 18:13:28 -10: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
b633587b49 Fix flush+error bug on server disconnect.
Also assign a client ID to each client because stream.fd isn't available in node 0.6.
2011-11-13 18:11:28 -10:00
Matt Ranney
f2a6a20a74 Send quit command right away.
The quit/pipeline bug has been fixed in Redis server for some time now.
2011-11-13 18:10:22 -10:00
Matt Ranney
c74657cdfa Improved reconnect logic. Initial version of reconnect thresholds. 2011-11-10 13:09:39 -10:00
Matt Ranney
8e338c6136 node 0.6 fixes 2011-11-10 13:05:46 -10:00
Owen Smith
54cf583dc3 Support new option 'max_attempts' to specify a total number of connection retries 2011-11-10 13:05:46 -10:00
Owen Smith
025c2e938e Support new option 'connect_timeout' to stop connection retries after the number of ms specified 2011-11-10 13:03:51 -10:00
Matt Ranney
8a2c1ad227 Merge pull request #141 from felixge/missing-self
Fix bad reference to 'this'
2011-11-10 14:55:38 -08:00
Dayananda Nanjundappa
a6670edb9a Support for retrieving data as Buffer on a per command basis
This is achieved by introducing a new option to the createClient method called bufferedInput.
If bufferedInput is set to true, then the returned data will be a Buffer if the command argument passed is a buffer

E.g.
    var redis = require("redis"),
    client = redis.createClient(<port>, <host>, {buffered_input: true});

    client.set("foo_rand000000000000", "OK");

    // The below get request will return a utf8 string
    client.get("foo_rand000000000000", function (err, reply) {
        console.log(reply.toString()); // Will print `OK`
    });

    // The below get request will return a Buffer as the key is specified as a Buffer
    client.get(new Buffer("foo_rand000000000000"), function (err, reply) {
        console.log(reply.toString()); // Will print `<Buffer 4f 4b>`
    });
    client.end();
2011-11-03 16:32:47 +05:30
Maksim Lin
804970f895 added handy example of using sort command using code posted by linus in mranney/node_redis/#103 2011-10-27 15:11:12 +11:00
Jean-Hugues Pinson
074555396b override select method to store selected db in client instance and restore selected db on connect 2011-10-20 10:01:47 +02:00
Felix Geisendörfer
61ddce87fa Fix bad reference to 'this' 2011-10-19 14:48:01 +02: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
bobrik
0c1c8cab83 added test for optional callbacks 2011-10-15 17:07:40 +04:00
Ian Babrou
f30ecbe561 added ability to pass undefined instead of callback 2011-10-02 11:42:23 +04:00
Matt Ranney
3e95c55a03 Fix for [GH-127]
Re-initialize the reply parser for every new connection.  If a connection is terminated,
the parser could be left in a bad state.  After the auto-reconnect magic kicks in, it
tries to reuse the old parser, which will not work.

This change is visible to client programs if you depend on client.reply_parser.name being
set immediately.  It will now only be set after a connection is established.

Thanks to @jhurliman for reporting and @pietern for the fix suggestion.
2011-08-11 11:00:02 -07:00
Matt Ranney
688b838be7 Revert "Fixes the case where if the quit() method is called, the closing variable checks are not honoured."
This reverts commit 263965ae44.

Conflicts:

	index.js
v0.6.7
2011-07-30 17:29:39 -07:00
Matt Ranney
50d9f8d45e Fix and test for [GH-123]
Passing an Array as as the last argument should expand as users
expect.  The old behavior was to coerce the arguments into Strings,
which did surprising things with Arrays.
2011-07-30 17:24:10 -07:00
Matt Ranney
6d9298e418 Merge pull request #122 from markdaws/master
Bug when calling quit()
2011-07-30 16:49:42 -07:00
Mark Dawson
263965ae44 Fixes the case where if the quit() method is called, the closing variable checks are not honoured. 2011-07-18 22:08:43 -07:00
Matt Ranney
3cc297ada4 Contributed changes:
*  Support SlowBuffers (Umair Siddique)
*  Add Multi to exports (Louis-Philippe Perron)
*  Fix for drain event calculation (Vladimir Dronnikov)

Thanks!
v0.6.5
2011-07-06 09:49:40 -05:00
Matt Ranney
49300363e4 Merge pull request #118 from dvv/master
fix for drain event
2011-07-06 07:28:37 -07:00
Matt Ranney
256ce6b736 Merge pull request #119 from umairsiddique/master
SlowBuffer support
2011-07-06 07:18:07 -07:00
Matt Ranney
d99f3d988e Merge pull request #120 from lp/master
commodity exports.Multi
2011-07-06 07:03:08 -07:00
Louis-Philippe Perron
abc647ccb5 exports Multi as commodity 2011-07-04 15:18:03 -04:00
Umair Siddique
769748f473 Now it works with SlowBuffer too. 2011-07-04 06:13:29 +05:00
Vladimir Dronnikov
607cd71208 hz 2011-07-01 09:27:03 -04:00
Vladimir Dronnikov
f93af92fac updated stress tests 2011-07-01 08:40:02 -04:00
Vladimir Dronnikov
cc2c3f7776 another pub/sub strategy 2011-07-01 04:27:59 -04:00
Vladimir Dronnikov
9a4e51ee40 fix for buffered_writes -- now drain event works 2011-07-01 03:46:50 -04:00
Vladimir Dronnikov
02c3b01f0e added leaking stress tests. need to employ ned backpressure feature 2011-07-01 02:51:46 -04:00
Matt Ranney
891529c06a Fix bug with optional callbacks for hmset. 2011-06-30 16:13:57 -06:00