Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ioredis

Package Overview
Dependencies
Maintainers
1
Versions
228
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ioredis - npm Package Compare versions

Comparing version 1.0.4 to 1.0.6

.idea/.name

1

API.md

@@ -63,2 +63,3 @@ #Index

when execute the command when the connection isn't ready, an error will be returned.
- \[connectTimeout=10000\] `number` - The milliseconds before a timeout occurs during the initial connection to the Redis server.
- \[lazyConnect=false\] `boolean` - By default,

@@ -65,0 +66,0 @@ When a new `Redis` instance is created, it will connect to Redis server automatically.

@@ -12,3 +12,2 @@ var _ = require('lodash');

var Script = require('./script');
var SubscriptionSet = require('./subscription_set');
var SubscriptionQueue = require('./subscription_queue');

@@ -51,2 +50,3 @@ var utils = require('./utils');

* when execute the command when the connection isn't ready, an error will be returned.
* @param {number} [options.connectTimeout=10000] - The milliseconds before a timeout occurs during the initial connection to the Redis server.
* @param {boolean} [options.lazyConnect=false] - By default,

@@ -193,2 +193,3 @@ * When a new `Redis` instance is created, it will connect to Redis server automatically.

roleRetryDelay: 500,
connectTimeout: 10000,
name: null

@@ -241,2 +242,12 @@ };

self.connection.on('data', eventHandler.dataHandler(self));
if (self.options.connectTimeout) {
self.connection.setTimeout(self.options.connectTimeout, function () {
self.connection.setTimeout(0);
self.manuallyClosing = true;
self.connection.destroy();
});
self.connection.once('connect', function () {
self.connection.setTimeout(0);
});
}
}

@@ -243,0 +254,0 @@ };

2

lib/sentinel.js

@@ -16,3 +16,3 @@ var util = require('util');

this.name = name;
this.connecting = 0;
this.connecting = false;
}

@@ -19,0 +19,0 @@

{
"name": "ioredis",
"version": "1.0.4",
"version": "1.0.6",
"description": "A delightful, performance-focused Redis client for Node and io.js",

@@ -20,3 +20,5 @@ "main": "index.js",

"node",
"io"
"io",
"cluster",
"sentinel"
],

@@ -23,0 +25,0 @@ "author": "luin <i@zihua.li> (http://zihua.li)",

@@ -30,4 +30,4 @@ # ioredis

# Links
[API Documentation](API.md)
[Migrating from node_redis](https://github.com/luin/ioredis/wiki/Migrating-from-node_redis)
* [API Documentation](API.md)
* [Migrating from node_redis](https://github.com/luin/ioredis/wiki/Migrating-from-node_redis)

@@ -82,2 +82,4 @@ # Quick Start

See [API Documentation](API.md#new_Redis) for all available options.
## Pub/Sub

@@ -471,2 +473,20 @@

# Running tests
Start a Redis server on 127.0.0.1:6379, and then:
```shell
$ npm test
```
`FLUSH ALL` will be invoked after each test, so make sure there's no valuable data in it before running tests.
# Debug
You can set the `DEBUG` env to `ioredis:*` to print debug info:
```shell
$ DEBUG=ioredis:* node app.js
```
# Motivation

@@ -473,0 +493,0 @@

@@ -9,2 +9,3 @@ describe('auth', function () {

expect(authed).to.eql(true);
redis.disconnect();
server.disconnect();

@@ -15,3 +16,3 @@ done();

var redis = new Redis({ port: 17379, password: 'pass' });
redis.get('foo');
redis.get('foo').catch(function () {});
});

@@ -30,2 +31,3 @@

expect(authed).to.eql(true);
redis.disconnect();
server.disconnect();

@@ -39,5 +41,5 @@ done();

redis.disconnect({ reconnect: true });
redis.get('foo');
redis.get('foo').catch(function () {});
});
});
});

@@ -41,2 +41,19 @@ describe('connection', function () {

});
it('should close the connection when timeout', function (done) {
var redis = new Redis(6379, '192.0.0.0', { connectTimeout: 1 });
redis.get('foo', function (err) {
expect(err.message).to.match(/Connection is closed/);
done();
});
});
it('should clear the timeout when connected', function (done) {
var redis = new Redis({ connectTimeout: 10000 });
stub(redis.connection, 'setTimeout', function (timeout) {
expect(timeout).to.eql(0);
redis.connection.setTimeout.restore();
done();
});
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc