Skip to content
Browse files

some improvements to the data side

  • Loading branch information...
1 parent 49e133e commit 4ff10735cd4288b6aee79e943ef3428b7375ee30 @jettro committed Apr 25, 2011
Showing with 4 additions and 4 deletions.
  1. +1 −1 data.js
  2. +2 −2 redis.js
  3. +1 −1 socketio.js
View
2 data.js
@@ -15,7 +15,7 @@ Data.prototype.index = function(req,res) {
Data.prototype.messages = function(req,res) {
if (!checkAdminUser(req,res)) return;
var messages = [];
- redis.obtainMessages(function(replies) {
+ redis.obtainMessages(0,-1,function(replies) {
replies.forEach(function (reply, i) {
messages.push(JSON.parse(reply));
});
View
4 redis.js
@@ -20,10 +20,10 @@ Redis.prototype.storeMessage = function (chatMessage) {
}
};
-Redis.prototype.obtainMessages = function(callback) {
+Redis.prototype.obtainMessages = function(start,amount,callback) {
if (redisEnabled) {
initClient();
- client.lrange("messages", 0, 14, function(err, replies) {
+ client.lrange("messages", start, amount-1, function(err, replies) {
callback(replies);
});
client.quit();
View
2 socketio.js
@@ -20,7 +20,7 @@ var Redis = require('./redis');
var redis = new Redis();
var sanitize = require('validator').sanitize;
-redis.obtainMessages(function(replies) {
+redis.obtainMessages(0,15,function(replies) {
replies.forEach(function (reply, i) {
buffer.push(JSON.parse(reply));
});

0 comments on commit 4ff1073

Please sign in to comment.
Something went wrong with that request. Please try again.