Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ea2348682e | |||
| 684e940266 | |||
| 5bd67aedb5 | |||
| 456b76ec71 | |||
| 04a68797f0 | |||
| 49fb05e1f2 | |||
| e76c9e736c | |||
| 9777d1acfe | |||
| 253549d2e7 | |||
| fee61a8d65 |
+6
-2
@@ -1,13 +1,17 @@
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "0.6"
|
||||
- "0.8"
|
||||
- "0.10"
|
||||
- "0.11"
|
||||
|
||||
services:
|
||||
- redis-server
|
||||
|
||||
before_install:
|
||||
- test $TRAVIS_NODE_VERSION = '0.8' && npm install -g npm@1.2.8000 || true
|
||||
|
||||
before_script:
|
||||
- make
|
||||
|
||||
env: TRAVIS=1
|
||||
|
||||
|
||||
@@ -21,4 +21,3 @@
|
||||
### 0.1.0 / 2012-02-26
|
||||
|
||||
* Initial release: Redis backend for Faye 0.8
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Code of Conduct
|
||||
|
||||
All projects under the [Faye](https://github.com/faye) umbrella are covered by
|
||||
the [Code of Conduct](https://github.com/faye/code-of-conduct).
|
||||
@@ -1,6 +1,5 @@
|
||||
prepare:
|
||||
git submodule update --init --recursive
|
||||
cd vendor/faye && npm install
|
||||
cd vendor/faye && npm install
|
||||
cd vendor/faye && ./node_modules/.bin/wake
|
||||
npm install
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# faye-redis [](http://travis-ci.org/faye/faye-redis-node)
|
||||
# faye-redis [](http://travis-ci.org/faye/faye-redis-node)
|
||||
|
||||
This plugin provides a Redis-based backend for the
|
||||
[Faye](http://faye.jcoglan.com) messaging server. It allows a single Faye
|
||||
@@ -63,4 +63,3 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
+18
-17
@@ -81,28 +81,29 @@ Engine.prototype = {
|
||||
destroyClient: function(clientId, callback, context) {
|
||||
var self = this;
|
||||
|
||||
this._redis.zadd(this._ns + '/clients', 0, clientId, function() {
|
||||
self._redis.smembers(self._ns + '/clients/' + clientId + '/channels', function(error, channels) {
|
||||
var n = channels.length, i = 0;
|
||||
if (i === n) return self._afterSubscriptionsRemoved(clientId, callback, context);
|
||||
this._redis.smembers(this._ns + '/clients/' + clientId + '/channels', function(error, channels) {
|
||||
var multi = self._redis.multi();
|
||||
|
||||
channels.forEach(function(channel) {
|
||||
self.unsubscribe(clientId, channel, function() {
|
||||
i += 1;
|
||||
if (i === n) self._afterSubscriptionsRemoved(clientId, callback, context);
|
||||
});
|
||||
});
|
||||
multi.zadd(self._ns + '/clients', 0, clientId);
|
||||
|
||||
channels.forEach(function(channel) {
|
||||
multi.srem(self._ns + '/clients/' + clientId + '/channels', channel);
|
||||
multi.srem(self._ns + '/channels' + channel, clientId);
|
||||
});
|
||||
});
|
||||
},
|
||||
multi.del(self._ns + '/clients/' + clientId + '/messages');
|
||||
multi.zrem(self._ns + '/clients', clientId);
|
||||
multi.publish(self._closeChannel, clientId);
|
||||
|
||||
multi.exec(function(error, results) {
|
||||
channels.forEach(function(channel, i) {
|
||||
if (results[2 * i + 1] !== 1) return;
|
||||
self._server.trigger('unsubscribe', clientId, channel);
|
||||
self._server.debug('Unsubscribed client ? from channel ?', clientId, channel);
|
||||
});
|
||||
|
||||
_afterSubscriptionsRemoved: function(clientId, callback, context) {
|
||||
var self = this;
|
||||
this._redis.del(this._ns + '/clients/' + clientId + '/messages', function() {
|
||||
self._redis.zrem(self._ns + '/clients', clientId, function() {
|
||||
self._server.debug('Destroyed client ?', clientId);
|
||||
self._server.trigger('disconnect', clientId);
|
||||
self._redis.publish(self._closeChannel, clientId);
|
||||
|
||||
if (callback) callback.call(context);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,4 +19,3 @@
|
||||
, "url" : "git://github.com/faye/faye-redis-node.git"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ JS.Test.describe("Redis engine", function() { with(this) {
|
||||
})
|
||||
|
||||
after(function(resume) { with(this) {
|
||||
engine.disconnect()
|
||||
disconnect_engine()
|
||||
var redis = require('redis').createClient(6379, 'localhost', {no_ready_check: true})
|
||||
redis.auth(engineOpts.password)
|
||||
redis.flushall(function() {
|
||||
|
||||
@@ -39,4 +39,3 @@ list-max-ziplist-value 64
|
||||
set-max-intset-entries 512
|
||||
|
||||
activerehashing yes
|
||||
|
||||
|
||||
@@ -5,4 +5,3 @@ require('../vendor/faye/spec/javascript/engine_spec')
|
||||
require('./faye_redis_spec')
|
||||
|
||||
JS.Test.autorun()
|
||||
|
||||
|
||||
Vendored
+1
-1
Submodule vendor/faye updated: b7dd8015ed...aab4127591
Reference in New Issue
Block a user