Browse Source

Fix filter predicate for inactiveUsers in delete-unused-accounts-cron

The filter predicate was selecting users who had logged in during the
past month, whereas we want the opposite.
master
Mike Appleby 8 years ago
parent
commit
aa5a0ab092
  1. 2
      delete-unused-accounts-cron/functions/index.js

2
delete-unused-accounts-cron/functions/index.js

@ -46,7 +46,7 @@ exports.accountcleanup = functions.https.onRequest((req, res) => {
getUsers().then(users => {
// Find users that have not signed in in the last 30 days.
const inactiveUsers = users.filter(
user => parseInt(user.lastLoginAt, 10) > Date.now() - 30 * 24 * 60 * 60 * 1000);
user => parseInt(user.lastLoginAt, 10) < Date.now() - 30 * 24 * 60 * 60 * 1000);
// Use a pool so that we delete maximum `MAX_CONCURRENT` users in parallel.
const promisePool = new PromisePool(() => {

Loading…
Cancel
Save