From aa5a0ab092f8cf224c002d732210a2dfbd6671a6 Mon Sep 17 00:00:00 2001 From: Mike Appleby Date: Thu, 4 May 2017 14:12:44 -0500 Subject: [PATCH] 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. --- delete-unused-accounts-cron/functions/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/delete-unused-accounts-cron/functions/index.js b/delete-unused-accounts-cron/functions/index.js index 9c1915d..b611eea 100644 --- a/delete-unused-accounts-cron/functions/index.js +++ b/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(() => {