Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Optimize removes from mongo db

  • Loading branch information...
commit a8a4955b2d15e2c8a8614cb53e04669d45cef9de 1 parent 04d0857
Josh Ellithorpe authored
Showing with 2 additions and 7 deletions.
  1. +2 −7 simplechat.js
9 simplechat.js
View
@@ -164,13 +164,8 @@ if (Meteor.is_server) {
Meteor.setInterval(function () {
var now = (new Date()).getTime();
- Users.find({last_seen: {$lt: (now - 60 * 1000)}}).forEach(function (user) {
- Users.remove(user._id);
- });
-
- Messages.find({date: {$gt: (now)}}).forEach(function (message) {
- Messages.remove(message._id);
- });
+ Users.remove({last_seen: {$lt: (now - 60 * 1000)}});
+ Messages.remove({date: {$gt: new Date()}});
});
Meteor.methods({
Please sign in to comment.
Something went wrong with that request. Please try again.