From fae6e4da8f516a9d6c3bad9bf6f35811ccacbad8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Feb 2021 14:44:12 +0100 Subject: Try to speed up server tests --- server/controllers/api/users/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'server/controllers/api/users/index.ts') diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index 5911d1a0f..fa0688a9e 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts @@ -307,7 +307,10 @@ async function removeUser (req: express.Request, res: express.Response) { auditLogger.delete(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON())) - await user.destroy() + await sequelizeTypescript.transaction(async t => { + // Use a transaction to avoid inconsistencies with hooks (account/channel deletion & federation) + await user.destroy({ transaction: t }) + }) Hooks.runAction('action:api.user.deleted', { user }) -- cgit v1.2.3