diff --git a/src/server/cron.coffee b/src/server/cron.coffee index 69ae8b7eed..a92d0f0a9a 100644 --- a/src/server/cron.coffee +++ b/src/server/cron.coffee @@ -22,20 +22,20 @@ module.exports.deleteStaleAccounts = -> today = +new Date - isValidDate = (d) -> - return false if Object::toString.call(d) isnt "[object Date]" - not isNaN(d.getTime()) +# isValidDate = (d) -> +# return false if Object::toString.call(d) isnt "[object Date]" +# not isNaN(d.getTime()) removeAccount = (collection, id) -> collection.remove {_id: id}, (err, res) -> throw err if err collection.findEach un_registered, (err, user) -> throw err if err return unless user? #why does this happen sometimes? - lastCron = new Date(user.lastCron) - if !isValidDate(lastCron) + unless user.lastCron removeAccount(collection, user._id) return + + lastCron = new Date(user.lastCron) diff = Math.abs(moment(today).sod().diff(moment(lastCron).sod(), "days")) if diff > 15 - removeAccount(collection, user._id) - return \ No newline at end of file + removeAccount(collection, user._id) \ No newline at end of file