diff options
author | Chocobozzz <me@florianbigard.com> | 2023-05-15 15:06:14 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-05-15 15:06:14 +0200 |
commit | 5a05c14573ca3c0d16b77bef78d845f96c8c6497 (patch) | |
tree | 3576ecd3d3e88209e9e66c937a56d284c001c43b | |
parent | 1a5b7dff7fa1fc8b55ed12008f7720b46671e3d3 (diff) | |
download | PeerTube-5a05c14573ca3c0d16b77bef78d845f96c8c6497.tar.gz PeerTube-5a05c14573ca3c0d16b77bef78d845f96c8c6497.tar.zst PeerTube-5a05c14573ca3c0d16b77bef78d845f96c8c6497.zip |
Force live stream termination
-rw-r--r-- | server/lib/live/live-manager.ts | 5 | ||||
-rw-r--r-- | server/tests/api/moderation/video-blacklist.ts | 10 | ||||
-rw-r--r-- | server/tests/api/object-storage/videos.ts | 2 | ||||
-rw-r--r-- | shared/server-commands/videos/live.ts | 2 |
4 files changed, 6 insertions, 13 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' | |||
6 | import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config' | 6 | import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config' |
7 | import { VIDEO_LIVE } from '@server/initializers/constants' | 7 | import { VIDEO_LIVE } from '@server/initializers/constants' |
8 | import { sequelizeTypescript } from '@server/initializers/database' | 8 | import { sequelizeTypescript } from '@server/initializers/database' |
9 | import { RunnerJobModel } from '@server/models/runner/runner-job' | ||
9 | import { UserModel } from '@server/models/user/user' | 10 | import { UserModel } from '@server/models/user/user' |
10 | import { VideoModel } from '@server/models/video/video' | 11 | import { VideoModel } from '@server/models/video/video' |
11 | import { VideoLiveModel } from '@server/models/video/video-live' | 12 | import { VideoLiveModel } from '@server/models/video/video-live' |
@@ -25,7 +26,6 @@ import { computeResolutionsToTranscode } from '../transcoding/transcoding-resolu | |||
25 | import { LiveQuotaStore } from './live-quota-store' | 26 | import { LiveQuotaStore } from './live-quota-store' |
26 | import { cleanupAndDestroyPermanentLive, getLiveSegmentTime } from './live-utils' | 27 | import { cleanupAndDestroyPermanentLive, getLiveSegmentTime } from './live-utils' |
27 | import { MuxingSession } from './shared' | 28 | import { MuxingSession } from './shared' |
28 | import { RunnerJobModel } from '@server/models/runner/runner-job' | ||
29 | 29 | ||
30 | const NodeRtmpSession = require('node-media-server/src/node_rtmp_session') | 30 | const NodeRtmpSession = require('node-media-server/src/node_rtmp_session') |
31 | const context = require('node-media-server/src/node_core_ctx') | 31 | const 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 |
diff --git a/shared/server-commands/videos/live.ts b/shared/server-commands/videos/live.ts index 3b09d3ff8..48464fb61 100644 --- a/shared/server-commands/videos/live.ts +++ b/shared/server-commands/videos/live.ts | |||
@@ -63,7 +63,7 @@ async function testFfmpegStreamError (command: FfmpegCommand, shouldHaveError: b | |||
63 | let error: Error | 63 | let error: Error |
64 | 64 | ||
65 | try { | 65 | try { |
66 | await waitFfmpegUntilError(command, 35000) | 66 | await waitFfmpegUntilError(command, 45000) |
67 | } catch (err) { | 67 | } catch (err) { |
68 | error = err | 68 | error = err |
69 | } | 69 | } |