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/server/debug.ts | 6 ++++-- server/controllers/api/users/index.ts | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'server/controllers/api') diff --git a/server/controllers/api/server/debug.ts b/server/controllers/api/server/debug.ts index e12fc1dd4..7787186be 100644 --- a/server/controllers/api/server/debug.ts +++ b/server/controllers/api/server/debug.ts @@ -1,3 +1,4 @@ +import { InboxManager } from '@server/lib/activitypub/inbox-manager' import * as express from 'express' import { UserRight } from '../../../../shared/models/users' import { authenticate, ensureUserHasRight } from '../../../middlewares' @@ -20,6 +21,7 @@ export { function getDebug (req: express.Request, res: express.Response) { return res.json({ - ip: req.ip - }).end() + ip: req.ip, + activityPubMessagesWaiting: InboxManager.Instance.getActivityPubMessagesWaiting() + }) } 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