aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-18 14:44:12 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-02-19 09:36:50 +0100
commitfae6e4da8f516a9d6c3bad9bf6f35811ccacbad8 (patch)
tree38df5942cb2fa6e5860c8e0e19471eb6b124e291 /server/controllers/api
parent3f8ae0e4e4da90c964597e4b3e0724da5eaa1668 (diff)
downloadPeerTube-fae6e4da8f516a9d6c3bad9bf6f35811ccacbad8.tar.gz
PeerTube-fae6e4da8f516a9d6c3bad9bf6f35811ccacbad8.tar.zst
PeerTube-fae6e4da8f516a9d6c3bad9bf6f35811ccacbad8.zip
Try to speed up server tests
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/server/debug.ts6
-rw-r--r--server/controllers/api/users/index.ts5
2 files changed, 8 insertions, 3 deletions
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 @@
1import { InboxManager } from '@server/lib/activitypub/inbox-manager'
1import * as express from 'express' 2import * as express from 'express'
2import { UserRight } from '../../../../shared/models/users' 3import { UserRight } from '../../../../shared/models/users'
3import { authenticate, ensureUserHasRight } from '../../../middlewares' 4import { authenticate, ensureUserHasRight } from '../../../middlewares'
@@ -20,6 +21,7 @@ export {
20 21
21function getDebug (req: express.Request, res: express.Response) { 22function getDebug (req: express.Request, res: express.Response) {
22 return res.json({ 23 return res.json({
23 ip: req.ip 24 ip: req.ip,
24 }).end() 25 activityPubMessagesWaiting: InboxManager.Instance.getActivityPubMessagesWaiting()
26 })
25} 27}
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) {
307 307
308 auditLogger.delete(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON())) 308 auditLogger.delete(getAuditIdFromRes(res), new UserAuditView(user.toFormattedJSON()))
309 309
310 await user.destroy() 310 await sequelizeTypescript.transaction(async t => {
311 // Use a transaction to avoid inconsistencies with hooks (account/channel deletion & federation)
312 await user.destroy({ transaction: t })
313 })
311 314
312 Hooks.runAction('action:api.user.deleted', { user }) 315 Hooks.runAction('action:api.user.deleted', { user })
313 316