aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/test.yml4
-rw-r--r--server/controllers/api/server/debug.ts6
-rw-r--r--server/controllers/api/users/index.ts5
-rw-r--r--server/lib/activitypub/inbox-manager.ts6
-rw-r--r--server/tests/api/live/live-save-replay.ts29
-rw-r--r--server/tests/api/live/live.ts30
-rw-r--r--shared/extra-utils/index.ts37
-rw-r--r--shared/extra-utils/server/debug.ts19
-rw-r--r--shared/extra-utils/server/jobs.ts23
-rw-r--r--shared/models/server/index.ts1
-rw-r--r--shared/models/server/server-debug.model.ts4
11 files changed, 112 insertions, 52 deletions
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index fe9851dc7..aba652586 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -42,7 +42,7 @@ jobs:
42 env: 42 env:
43 PGUSER: peertube 43 PGUSER: peertube
44 PGHOST: localhost 44 PGHOST: localhost
45 NODE_PENDING_JOB_WAIT: 2000 45 NODE_PENDING_JOB_WAIT: 500
46 46
47 steps: 47 steps:
48 - uses: actions/checkout@v2 48 - uses: actions/checkout@v2
@@ -93,7 +93,7 @@ jobs:
93 - name: Run Test 93 - name: Run Test
94 # external-plugins tests only run on schedule 94 # external-plugins tests only run on schedule
95 if: github.event_name == 'schedule' || matrix.test_suite != 'external-plugins' 95 if: github.event_name == 'schedule' || matrix.test_suite != 'external-plugins'
96 run: NODE_PENDING_JOB_WAIT=2000 npm run ci -- ${{ matrix.test_suite }} 96 run: npm run ci -- ${{ matrix.test_suite }}
97 97
98 - name: Display errors 98 - name: Display errors
99 if: ${{ always() }} 99 if: ${{ always() }}
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
diff --git a/server/lib/activitypub/inbox-manager.ts b/server/lib/activitypub/inbox-manager.ts
index 6d9bf7cf0..18ae49532 100644
--- a/server/lib/activitypub/inbox-manager.ts
+++ b/server/lib/activitypub/inbox-manager.ts
@@ -35,7 +35,7 @@ class InboxManager {
35 }) 35 })
36 36
37 setInterval(() => { 37 setInterval(() => {
38 StatsManager.Instance.updateInboxStats(this.messagesProcessed, this.inboxQueue.length()) 38 StatsManager.Instance.updateInboxStats(this.messagesProcessed, this.getActivityPubMessagesWaiting())
39 }, SCHEDULER_INTERVALS_MS.updateInboxStats) 39 }, SCHEDULER_INTERVALS_MS.updateInboxStats)
40 } 40 }
41 41
@@ -44,6 +44,10 @@ class InboxManager {
44 .catch(err => logger.error('Cannot add options in inbox queue.', { options, err })) 44 .catch(err => logger.error('Cannot add options in inbox queue.', { options, err }))
45 } 45 }
46 46
47 getActivityPubMessagesWaiting () {
48 return this.inboxQueue.length() + this.inboxQueue.running()
49 }
50
47 static get Instance () { 51 static get Instance () {
48 return this.instance || (this.instance = new this()) 52 return this.instance || (this.instance = new this())
49 } 53 }
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index 757e11845..6dd6fb44e 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -4,6 +4,7 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { FfmpegCommand } from 'fluent-ffmpeg' 5import { FfmpegCommand } from 'fluent-ffmpeg'
6import { LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState } from '@shared/models' 6import { LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState } from '@shared/models'
7import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
7import { 8import {
8 addVideoToBlacklist, 9 addVideoToBlacklist,
9 checkLiveCleanup, 10 checkLiveCleanup,
@@ -23,9 +24,9 @@ import {
23 updateCustomSubConfig, 24 updateCustomSubConfig,
24 updateVideo, 25 updateVideo,
25 waitJobs, 26 waitJobs,
27 waitUntilLiveEnded,
26 waitUntilLivePublished 28 waitUntilLivePublished
27} from '../../../../shared/extra-utils' 29} from '../../../../shared/extra-utils'
28import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
29 30
30const expect = chai.expect 31const expect = chai.expect
31 32
@@ -74,6 +75,12 @@ describe('Save replay setting', function () {
74 } 75 }
75 } 76 }
76 77
78 async function waitUntilLivePublishedOnAllServers (videoId: string) {
79 for (const server of servers) {
80 await waitUntilLivePublished(server.url, server.accessToken, videoId)
81 }
82 }
83
77 before(async function () { 84 before(async function () {
78 this.timeout(120000) 85 this.timeout(120000)
79 86
@@ -125,10 +132,11 @@ describe('Save replay setting', function () {
125 }) 132 })
126 133
127 it('Should correctly have updated the live and federated it when streaming in the live', async function () { 134 it('Should correctly have updated the live and federated it when streaming in the live', async function () {
128 this.timeout(20000) 135 this.timeout(30000)
129 136
130 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 137 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
131 await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) 138
139 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
132 140
133 await waitJobs(servers) 141 await waitJobs(servers)
134 142
@@ -141,6 +149,9 @@ describe('Save replay setting', function () {
141 149
142 await stopFfmpeg(ffmpegCommand) 150 await stopFfmpeg(ffmpegCommand)
143 151
152 for (const server of servers) {
153 await waitUntilLiveEnded(server.url, server.accessToken, liveVideoUUID)
154 }
144 await waitJobs(servers) 155 await waitJobs(servers)
145 156
146 // Live still exist, but cannot be played anymore 157 // Live still exist, but cannot be played anymore
@@ -159,7 +170,8 @@ describe('Save replay setting', function () {
159 liveVideoUUID = await createLiveWrapper(false) 170 liveVideoUUID = await createLiveWrapper(false)
160 171
161 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 172 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
162 await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) 173
174 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
163 175
164 await waitJobs(servers) 176 await waitJobs(servers)
165 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) 177 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
@@ -185,7 +197,8 @@ describe('Save replay setting', function () {
185 liveVideoUUID = await createLiveWrapper(false) 197 liveVideoUUID = await createLiveWrapper(false)
186 198
187 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 199 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
188 await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) 200
201 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
189 202
190 await waitJobs(servers) 203 await waitJobs(servers)
191 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) 204 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
@@ -219,7 +232,7 @@ describe('Save replay setting', function () {
219 this.timeout(20000) 232 this.timeout(20000)
220 233
221 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 234 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
222 await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) 235 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
223 236
224 await waitJobs(servers) 237 await waitJobs(servers)
225 238
@@ -262,7 +275,7 @@ describe('Save replay setting', function () {
262 liveVideoUUID = await createLiveWrapper(true) 275 liveVideoUUID = await createLiveWrapper(true)
263 276
264 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 277 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
265 await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) 278 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
266 279
267 await waitJobs(servers) 280 await waitJobs(servers)
268 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) 281 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
@@ -288,7 +301,7 @@ describe('Save replay setting', function () {
288 liveVideoUUID = await createLiveWrapper(true) 301 liveVideoUUID = await createLiveWrapper(true)
289 302
290 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 303 ffmpegCommand = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
291 await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) 304 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
292 305
293 await waitJobs(servers) 306 await waitJobs(servers)
294 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200) 307 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index ff822f84d..19976ba8a 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -50,6 +50,12 @@ const expect = chai.expect
50describe('Test live', function () { 50describe('Test live', function () {
51 let servers: ServerInfo[] = [] 51 let servers: ServerInfo[] = []
52 52
53 async function waitUntilLivePublishedOnAllServers (videoId: string) {
54 for (const server of servers) {
55 await waitUntilLivePublished(server.url, server.accessToken, videoId)
56 }
57 }
58
53 before(async function () { 59 before(async function () {
54 this.timeout(120000) 60 this.timeout(120000)
55 61
@@ -390,7 +396,7 @@ describe('Test live', function () {
390 liveVideoId = await createLiveWrapper(false) 396 liveVideoId = await createLiveWrapper(false)
391 397
392 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) 398 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId)
393 await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) 399 await waitUntilLivePublishedOnAllServers(liveVideoId)
394 await waitJobs(servers) 400 await waitJobs(servers)
395 401
396 await testVideoResolutions(liveVideoId, [ 720 ]) 402 await testVideoResolutions(liveVideoId, [ 720 ])
@@ -406,7 +412,7 @@ describe('Test live', function () {
406 liveVideoId = await createLiveWrapper(false) 412 liveVideoId = await createLiveWrapper(false)
407 413
408 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) 414 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId)
409 await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) 415 await waitUntilLivePublishedOnAllServers(liveVideoId)
410 await waitJobs(servers) 416 await waitJobs(servers)
411 417
412 await testVideoResolutions(liveVideoId, resolutions) 418 await testVideoResolutions(liveVideoId, resolutions)
@@ -423,7 +429,7 @@ describe('Test live', function () {
423 liveVideoId = await createLiveWrapper(true) 429 liveVideoId = await createLiveWrapper(true)
424 430
425 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId, 'video_short2.webm') 431 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId, 'video_short2.webm')
426 await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) 432 await waitUntilLivePublishedOnAllServers(liveVideoId)
427 await waitJobs(servers) 433 await waitJobs(servers)
428 434
429 await testVideoResolutions(liveVideoId, resolutions) 435 await testVideoResolutions(liveVideoId, resolutions)
@@ -433,7 +439,7 @@ describe('Test live', function () {
433 439
434 await waitJobs(servers) 440 await waitJobs(servers)
435 441
436 await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) 442 await waitUntilLivePublishedOnAllServers(liveVideoId)
437 443
438 const bitrateLimits = { 444 const bitrateLimits = {
439 720: 5000 * 1000, // 60FPS 445 720: 5000 * 1000, // 60FPS
@@ -514,7 +520,7 @@ describe('Test live', function () {
514 liveVideoId = res.body.video.uuid 520 liveVideoId = res.body.video.uuid
515 521
516 command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) 522 command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId)
517 await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoId) 523 await waitUntilLivePublishedOnAllServers(liveVideoId)
518 await waitJobs(servers) 524 await waitJobs(servers)
519 }) 525 })
520 526
@@ -602,10 +608,7 @@ describe('Test live', function () {
602 608
603 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 609 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
604 610
605 for (const server of servers) { 611 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
606 await waitUntilLivePublished(server.url, server.accessToken, liveVideoUUID)
607 }
608
609 await waitJobs(servers) 612 await waitJobs(servers)
610 613
611 for (const stateChanges of [ localStateChanges, remoteStateChanges ]) { 614 for (const stateChanges of [ localStateChanges, remoteStateChanges ]) {
@@ -618,7 +621,6 @@ describe('Test live', function () {
618 for (const server of servers) { 621 for (const server of servers) {
619 await waitUntilLiveEnded(server.url, server.accessToken, liveVideoUUID) 622 await waitUntilLiveEnded(server.url, server.accessToken, liveVideoUUID)
620 } 623 }
621
622 await waitJobs(servers) 624 await waitJobs(servers)
623 625
624 for (const stateChanges of [ localStateChanges, remoteStateChanges ]) { 626 for (const stateChanges of [ localStateChanges, remoteStateChanges ]) {
@@ -654,10 +656,7 @@ describe('Test live', function () {
654 656
655 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 657 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
656 658
657 for (const server of servers) { 659 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
658 await waitUntilLivePublished(server.url, server.accessToken, liveVideoUUID)
659 }
660
661 await waitJobs(servers) 660 await waitJobs(servers)
662 661
663 expect(localLastVideoViews).to.equal(0) 662 expect(localLastVideoViews).to.equal(0)
@@ -691,7 +690,8 @@ describe('Test live', function () {
691 socket.emit('subscribe', { videoId }) 690 socket.emit('subscribe', { videoId })
692 691
693 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID) 692 const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
694 await waitUntilLivePublished(servers[0].url, servers[0].accessToken, liveVideoUUID) 693
694 await waitUntilLivePublishedOnAllServers(liveVideoUUID)
695 await waitJobs(servers) 695 await waitJobs(servers)
696 696
697 expect(stateChanges).to.have.lengthOf(1) 697 expect(stateChanges).to.have.lengthOf(1)
diff --git a/shared/extra-utils/index.ts b/shared/extra-utils/index.ts
index 8f5c709ff..5c95a1b3e 100644
--- a/shared/extra-utils/index.ts
+++ b/shared/extra-utils/index.ts
@@ -1,32 +1,33 @@
1export * from './server/activitypub'
2export * from './bulk/bulk' 1export * from './bulk/bulk'
3export * from './cli/cli' 2export * from './cli/cli'
4export * from './server/clients' 3export * from './feeds/feeds'
5export * from './server/config' 4export * from './instances-index/mock-instances-index'
6export * from './server/jobs'
7export * from './users/login'
8export * from './miscs/miscs' 5export * from './miscs/miscs'
9export * from './miscs/stubs'
10export * from './miscs/sql' 6export * from './miscs/sql'
11export * from './server/follows' 7export * from './miscs/stubs'
12export * from './requests/requests' 8export * from './moderation/abuses'
9export * from './plugins/mock-blocklist'
13export * from './requests/check-api-params' 10export * from './requests/check-api-params'
14export * from './server/servers' 11export * from './requests/requests'
12export * from './search/videos'
13export * from './server/activitypub'
14export * from './server/clients'
15export * from './server/config'
16export * from './server/debug'
17export * from './server/follows'
18export * from './server/jobs'
15export * from './server/plugins' 19export * from './server/plugins'
16export * from './videos/video-playlists' 20export * from './server/servers'
17export * from './users/users'
18export * from './users/accounts' 21export * from './users/accounts'
19export * from './moderation/abuses' 22export * from './users/login'
20export * from './videos/services' 23export * from './users/users'
21export * from './videos/live' 24export * from './videos/live'
25export * from './videos/services'
22export * from './videos/video-blacklist' 26export * from './videos/video-blacklist'
23export * from './videos/video-captions' 27export * from './videos/video-captions'
28export * from './videos/video-change-ownership'
24export * from './videos/video-channels' 29export * from './videos/video-channels'
25export * from './videos/video-comments' 30export * from './videos/video-comments'
31export * from './videos/video-playlists'
26export * from './videos/video-streaming-playlists' 32export * from './videos/video-streaming-playlists'
27export * from './videos/videos' 33export * from './videos/videos'
28export * from './videos/video-change-ownership'
29export * from './feeds/feeds'
30export * from './instances-index/mock-instances-index'
31export * from './search/videos'
32export * from './plugins/mock-blocklist'
diff --git a/shared/extra-utils/server/debug.ts b/shared/extra-utils/server/debug.ts
new file mode 100644
index 000000000..5cf80a5fb
--- /dev/null
+++ b/shared/extra-utils/server/debug.ts
@@ -0,0 +1,19 @@
1import { makeGetRequest } from '../requests/requests'
2import { HttpStatusCode } from '../../core-utils/miscs/http-error-codes'
3
4function getDebug (url: string, token: string) {
5 const path = '/api/v1/server/debug'
6
7 return makeGetRequest({
8 url,
9 path,
10 token,
11 statusCodeExpected: HttpStatusCode.OK_200
12 })
13}
14
15// ---------------------------------------------------------------------------
16
17export {
18 getDebug
19}
diff --git a/shared/extra-utils/server/jobs.ts b/shared/extra-utils/server/jobs.ts
index a53749589..97971f960 100644
--- a/shared/extra-utils/server/jobs.ts
+++ b/shared/extra-utils/server/jobs.ts
@@ -1,7 +1,7 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' 2import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
3import { makeGetRequest } from '../../../shared/extra-utils' 3import { getDebug, makeGetRequest } from '../../../shared/extra-utils'
4import { Job, JobState, JobType } from '../../models' 4import { Job, JobState, JobType, ServerDebug } from '../../models'
5import { wait } from '../miscs/miscs' 5import { wait } from '../miscs/miscs'
6import { ServerInfo } from './servers' 6import { ServerInfo } from './servers'
7 7
@@ -53,7 +53,10 @@ function getJobsListPaginationAndSort (options: {
53} 53}
54 54
55async function waitJobs (serversArg: ServerInfo[] | ServerInfo) { 55async function waitJobs (serversArg: ServerInfo[] | ServerInfo) {
56 const pendingJobWait = process.env.NODE_PENDING_JOB_WAIT ? parseInt(process.env.NODE_PENDING_JOB_WAIT, 10) : 2000 56 const pendingJobWait = process.env.NODE_PENDING_JOB_WAIT
57 ? parseInt(process.env.NODE_PENDING_JOB_WAIT, 10)
58 : 500
59
57 let servers: ServerInfo[] 60 let servers: ServerInfo[]
58 61
59 if (Array.isArray(serversArg) === false) servers = [ serversArg as ServerInfo ] 62 if (Array.isArray(serversArg) === false) servers = [ serversArg as ServerInfo ]
@@ -75,16 +78,26 @@ async function waitJobs (serversArg: ServerInfo[] | ServerInfo) {
75 start: 0, 78 start: 0,
76 count: 10, 79 count: 10,
77 sort: '-createdAt' 80 sort: '-createdAt'
78 }) 81 }).then(res => res.body.data)
79 .then(res => res.body.data)
80 .then((jobs: Job[]) => jobs.filter(j => j.type !== 'videos-views')) 82 .then((jobs: Job[]) => jobs.filter(j => j.type !== 'videos-views'))
81 .then(jobs => { 83 .then(jobs => {
82 if (jobs.length !== 0) { 84 if (jobs.length !== 0) {
83 pendingRequests = true 85 pendingRequests = true
84 } 86 }
85 }) 87 })
88
86 tasks.push(p) 89 tasks.push(p)
87 } 90 }
91
92 const p = getDebug(server.url, server.accessToken)
93 .then(res => res.body)
94 .then((obj: ServerDebug) => {
95 if (obj.activityPubMessagesWaiting !== 0) {
96 pendingRequests = true
97 }
98 })
99
100 tasks.push(p)
88 } 101 }
89 102
90 return tasks 103 return tasks
diff --git a/shared/models/server/index.ts b/shared/models/server/index.ts
index f253a3a79..b5163954a 100644
--- a/shared/models/server/index.ts
+++ b/shared/models/server/index.ts
@@ -7,5 +7,6 @@ export * from './emailer.model'
7export * from './job.model' 7export * from './job.model'
8export * from './log-level.type' 8export * from './log-level.type'
9export * from './server-config.model' 9export * from './server-config.model'
10export * from './server-debug.model'
10export * from './server-error-code.enum' 11export * from './server-error-code.enum'
11export * from './server-stats.model' 12export * from './server-stats.model'
diff --git a/shared/models/server/server-debug.model.ts b/shared/models/server/server-debug.model.ts
new file mode 100644
index 000000000..4b731bb90
--- /dev/null
+++ b/shared/models/server/server-debug.model.ts
@@ -0,0 +1,4 @@
1export interface ServerDebug {
2 ip: string
3 activityPubMessagesWaiting: number
4}