aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-05-15 15:06:14 +0200
committerChocobozzz <me@florianbigard.com>2023-05-15 15:06:14 +0200
commit5a05c14573ca3c0d16b77bef78d845f96c8c6497 (patch)
tree3576ecd3d3e88209e9e66c937a56d284c001c43b /server
parent1a5b7dff7fa1fc8b55ed12008f7720b46671e3d3 (diff)
downloadPeerTube-5a05c14573ca3c0d16b77bef78d845f96c8c6497.tar.gz
PeerTube-5a05c14573ca3c0d16b77bef78d845f96c8c6497.tar.zst
PeerTube-5a05c14573ca3c0d16b77bef78d845f96c8c6497.zip
Force live stream termination
Diffstat (limited to 'server')
-rw-r--r--server/lib/live/live-manager.ts5
-rw-r--r--server/tests/api/moderation/video-blacklist.ts10
-rw-r--r--server/tests/api/object-storage/videos.ts2
3 files changed, 5 insertions, 12 deletions
diff --git a/server/lib/live/live-manager.ts b/server/lib/live/live-manager.ts
index c78cf82eb..6d51f4de7 100644
--- a/server/lib/live/live-manager.ts
+++ b/server/lib/live/live-manager.ts
@@ -6,6 +6,7 @@ import { logger, loggerTagsFactory } from '@server/helpers/logger'
6import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config' 6import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config'
7import { VIDEO_LIVE } from '@server/initializers/constants' 7import { VIDEO_LIVE } from '@server/initializers/constants'
8import { sequelizeTypescript } from '@server/initializers/database' 8import { sequelizeTypescript } from '@server/initializers/database'
9import { RunnerJobModel } from '@server/models/runner/runner-job'
9import { UserModel } from '@server/models/user/user' 10import { UserModel } from '@server/models/user/user'
10import { VideoModel } from '@server/models/video/video' 11import { VideoModel } from '@server/models/video/video'
11import { VideoLiveModel } from '@server/models/video/video-live' 12import { VideoLiveModel } from '@server/models/video/video-live'
@@ -25,7 +26,6 @@ import { computeResolutionsToTranscode } from '../transcoding/transcoding-resolu
25import { LiveQuotaStore } from './live-quota-store' 26import { LiveQuotaStore } from './live-quota-store'
26import { cleanupAndDestroyPermanentLive, getLiveSegmentTime } from './live-utils' 27import { cleanupAndDestroyPermanentLive, getLiveSegmentTime } from './live-utils'
27import { MuxingSession } from './shared' 28import { MuxingSession } from './shared'
28import { RunnerJobModel } from '@server/models/runner/runner-job'
29 29
30const NodeRtmpSession = require('node-media-server/src/node_rtmp_session') 30const NodeRtmpSession = require('node-media-server/src/node_rtmp_session')
31const context = require('node-media-server/src/node_core_ctx') 31const context = require('node-media-server/src/node_core_ctx')
@@ -80,6 +80,9 @@ class LiveManager {
80 80
81 events.on('donePublish', sessionId => { 81 events.on('donePublish', sessionId => {
82 logger.info('Live session ended.', { sessionId, ...lTags(sessionId) }) 82 logger.info('Live session ended.', { sessionId, ...lTags(sessionId) })
83
84 // Force session aborting, so we kill ffmpeg even if it still has data to process (slow CPU)
85 setTimeout(() => this.abortSession(sessionId), 2000)
83 }) 86 })
84 87
85 registerConfigChangedHandler(() => { 88 registerConfigChangedHandler(() => {
diff --git a/server/tests/api/moderation/video-blacklist.ts b/server/tests/api/moderation/video-blacklist.ts
index ad132aa39..ef087a93b 100644
--- a/server/tests/api/moderation/video-blacklist.ts
+++ b/server/tests/api/moderation/video-blacklist.ts
@@ -239,8 +239,6 @@ describe('Test video blacklist', function () {
239 let video4UUID: string 239 let video4UUID: string
240 240
241 before(async function () { 241 before(async function () {
242 this.timeout(10000)
243
244 { 242 {
245 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'Video 3' } }) 243 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'Video 3' } })
246 video3UUID = uuid 244 video3UUID = uuid
@@ -254,8 +252,6 @@ describe('Test video blacklist', function () {
254 }) 252 })
255 253
256 it('Should blacklist video 3 and keep it federated', async function () { 254 it('Should blacklist video 3 and keep it federated', async function () {
257 this.timeout(10000)
258
259 await command.add({ videoId: video3UUID, reason: 'super reason', unfederate: false }) 255 await command.add({ videoId: video3UUID, reason: 'super reason', unfederate: false })
260 256
261 await waitJobs(servers) 257 await waitJobs(servers)
@@ -272,8 +268,6 @@ describe('Test video blacklist', function () {
272 }) 268 })
273 269
274 it('Should unfederate the video', async function () { 270 it('Should unfederate the video', async function () {
275 this.timeout(10000)
276
277 await command.add({ videoId: video4UUID, reason: 'super reason', unfederate: true }) 271 await command.add({ videoId: video4UUID, reason: 'super reason', unfederate: true })
278 272
279 await waitJobs(servers) 273 await waitJobs(servers)
@@ -285,8 +279,6 @@ describe('Test video blacklist', function () {
285 }) 279 })
286 280
287 it('Should have the video unfederated even after an Update AP message', async function () { 281 it('Should have the video unfederated even after an Update AP message', async function () {
288 this.timeout(10000)
289
290 await servers[0].videos.update({ id: video4UUID, attributes: { description: 'super description' } }) 282 await servers[0].videos.update({ id: video4UUID, attributes: { description: 'super description' } })
291 283
292 await waitJobs(servers) 284 await waitJobs(servers)
@@ -309,8 +301,6 @@ describe('Test video blacklist', function () {
309 }) 301 })
310 302
311 it('Should remove the video from blacklist and refederate the video', async function () { 303 it('Should remove the video from blacklist and refederate the video', async function () {
312 this.timeout(10000)
313
314 await command.remove({ videoId: video4UUID }) 304 await command.remove({ videoId: video4UUID })
315 305
316 await waitJobs(servers) 306 await waitJobs(servers)
diff --git a/server/tests/api/object-storage/videos.ts b/server/tests/api/object-storage/videos.ts
index 77bb00678..77ed78ae1 100644
--- a/server/tests/api/object-storage/videos.ts
+++ b/server/tests/api/object-storage/videos.ts
@@ -152,7 +152,7 @@ function runTestSuite (options: {
152 let deletedUrls: string[] = [] 152 let deletedUrls: string[] = []
153 153
154 before(async function () { 154 before(async function () {
155 this.timeout(120000) 155 this.timeout(240000)
156 156
157 const port = await mockObjectStorageProxy.initialize() 157 const port = await mockObjectStorageProxy.initialize()
158 baseMockUrl = options.useMockBaseUrl 158 baseMockUrl = options.useMockBaseUrl