mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Fixed some issues with multi-db
This commit is contained in:
@@ -1253,11 +1253,13 @@ function send_ping() {
|
||||
/*lists = {};
|
||||
offline_users = [];
|
||||
tot_view = 0;*/
|
||||
db.collection("connected_users").update({users: {$exists: true}}, {$set: {users: []}}, function(err, docs){});
|
||||
db.collection("connected_users").update({"_id": "total_users"}, {$set: {total_users: 0}}, function(err, docs){});
|
||||
db.collection("frontpage_lists").update({viewers: {$ne: 0}}, {$set: {"viewers": 0}}, function(err, docs) {
|
||||
io.emit("self_ping");
|
||||
setTimeout(send_ping, 25000);
|
||||
db.collection("connected_users").update({users: {$exists: true}}, {$set: {users: []}}, {multi: true}, function(err, docs){
|
||||
db.collection("connected_users").update({"_id": "total_users"}, {$set: {total_users: 0}, {multi: true}}, function(err, docs){
|
||||
db.collection("frontpage_lists").update({viewers: {$ne: 0}}, {$set: {"viewers": 0}}, {multi: true}, function(err, docs) {
|
||||
io.emit("self_ping");
|
||||
setTimeout(send_ping, 25000);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1393,7 +1395,6 @@ function check_inlist(coll, guid, socket, name, offline)
|
||||
upsert: true,
|
||||
new: true,
|
||||
}, function(err, conn_users, objectTwo) {
|
||||
console.log(objectTwo);
|
||||
db.collection("frontpage_lists").update({"_id": coll}, {$set: {"viewers": conn_users.users.length}}, function(){
|
||||
io.to(coll).emit("viewers", conn_users.users.length);
|
||||
socket.broadcast.to(coll).emit('chat', {from: name, msg: " joined"});
|
||||
|
||||
Reference in New Issue
Block a user