mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 12:02:13 +00:00
clean up user cron and set back down to 10 days
This commit is contained in:
parent
cd331dbca5
commit
30db654eea
2 changed files with 7 additions and 4 deletions
|
|
@ -10,7 +10,7 @@ _ = require('underscore')
|
|||
module.exports.deleteStaleAccounts = ->
|
||||
|
||||
un_registered = { "auth.local": {$exists: false} , "auth.facebook": {$exists: false} }
|
||||
registered = registered = { $or: [
|
||||
registered = { $or: [
|
||||
{ 'auth.local': { $exists: true } },
|
||||
{ 'auth.facebook': { $exists: true} }
|
||||
]};
|
||||
|
|
@ -34,5 +34,8 @@ module.exports.deleteStaleAccounts = ->
|
|||
if !!user.lastCron # for now ignore missing crons, still looking into why this is happening
|
||||
lastCron = new Date(user.lastCron)
|
||||
diff = Math.abs(moment(today).sod().diff(moment(lastCron).sod(), "days"))
|
||||
if diff > 30
|
||||
removeAccount(collection, user._id)
|
||||
if diff > 10
|
||||
removeAccount(collection, user._id)
|
||||
else
|
||||
# cron was missing for some reason
|
||||
collection.update {_id: user._id}, {$set:{lastCron: today}}, (err, res) -> throw err if err
|
||||
|
|
@ -10,7 +10,7 @@ auth = require 'derby-auth'
|
|||
priv = require './private'
|
||||
|
||||
## Run server cron ##
|
||||
#require('./cron').deleteStaleAccounts()
|
||||
require('./cron').deleteStaleAccounts()
|
||||
|
||||
## RACER CONFIGURATION ##
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue