Skip to content

Commit 0f73d33

Browse files
committed
feat: delete unconfirmed users fixes
1 parent 20bcf6d commit 0f73d33

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

doc/rfcs/inactive_users_cleanup.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ For correct code deduplication in redis scripts, we need to provide some templat
3636
`deleteInactivated.lua`
3737
Delete process requires a lot of data resolved before execution and all database actions must be executed in one shot, to save database consistence. Exports `deleteInactivated` command into namespace and wrapped by `utils/inactive/deleteUsers.js`.
3838

39+
For Redis compat 5.0 > ver < 3.2 only db commands passed to replica servers. Lua script behaviour changed in Redis 5.0: replicates script as effect, older versions pass script between redis insances.
40+
3941
When script started:
4042
1. It extracts from `inactive-user` list of `userId` with score range '-inf' to 'currentimestamp - ttl'.
4143
2. Removes all user data including aliases, emails, metadata, tokens, SSO accounts, throttles and cleans all bound indicies

scripts/deleteInactivated.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ local function cleanInactiveUsers(idList)
148148
end
149149

150150
-- Command body
151+
redis.replicate_commands();
151152
local inactiveUsers = getInactiveUsers();
152153

153154
for k,v in pairs(inactiveUsers) do

src/actions/activate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ function activateAction({ params }) {
195195
};
196196

197197
return Promise
198-
.resolve(['users:cleanup'])
199-
.spread(this.hook.bind(this))
198+
.bind(this, ['users:cleanup'])
199+
.spread(this.hook)
200200
.bind(context)
201201
.then(verifyRequest)
202202
.bind(this)

src/actions/register.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ module.exports = async function registerUser({ params }) {
349349
.disposer(lockDisposer);
350350

351351
return Promise
352-
.resolve(['users:cleanup'])
353-
.spread(service.hook.bind(service))
352+
.bind(this, ['users:cleanup'])
353+
.spread(service.hook)
354354
.then(() => {
355355
return Promise.using({ service, params }, acquireLock, performRegistration);
356356
})

0 commit comments

Comments
 (0)