mirror of
https://github.com/KevinMidboe/zoff.git
synced 2026-01-09 19:15:34 +00:00
Fixed issue with infinate counter
This commit is contained in:
@@ -127,7 +127,7 @@ db.on('error',function(err) {
|
|||||||
console.log("\n" + new Date().toString() + "\n Database error: ", err);
|
console.log("\n" + new Date().toString() + "\n Database error: ", err);
|
||||||
});
|
});
|
||||||
|
|
||||||
db.collection("frontpage_lists").update({viewers: {$gt: 0}}, {$set: {"viewers": 0}}, function(err, docs) {});
|
db.collection("frontpage_lists").update({viewers: {$gt: 0}}, {$set: {"viewers": 0}}, {multi: true}, function(err, docs) {});
|
||||||
|
|
||||||
io.on('connection', function(socket){
|
io.on('connection', function(socket){
|
||||||
socket.emit("get_list");
|
socket.emit("get_list");
|
||||||
@@ -168,7 +168,8 @@ io.on('connection', function(socket){
|
|||||||
lists[channel] = [];
|
lists[channel] = [];
|
||||||
}
|
}
|
||||||
lists[channel].push(guid);
|
lists[channel].push(guid);
|
||||||
db.collection("frontpage_lists").update({"_id": channel}, {$inc: {viewers: 1}}, function(){});
|
|
||||||
|
db.collection("frontpage_lists").update({"_id": msg.channel}, {$inc: {viewers: 1}}, function(err, docs){});
|
||||||
}
|
}
|
||||||
tot_view += 1
|
tot_view += 1
|
||||||
});
|
});
|
||||||
@@ -1204,7 +1205,7 @@ function send_ping() {
|
|||||||
lists = {};
|
lists = {};
|
||||||
offline_users = [];
|
offline_users = [];
|
||||||
tot_view = 0;
|
tot_view = 0;
|
||||||
db.collection("frontpage_lists").update({viewers: {$gt: 0}}, {$set: {"viewers": 0}}, function(err, docs) {
|
db.collection("frontpage_lists").update({viewers: {$ne: 0}}, {$set: {"viewers": 0}}, {multi: true}, function(err, docs) {
|
||||||
io.emit("self_ping");
|
io.emit("self_ping");
|
||||||
setTimeout(send_ping, 4000);
|
setTimeout(send_ping, 4000);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user