aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/live/live-utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-10-25 14:18:59 +0200
committerChocobozzz <me@florianbigard.com>2022-10-25 14:18:59 +0200
commitaa887096f9a305568dc3a846d0c9cdf7e45f1c67 (patch)
tree5dc455d680ebdd24644ebe29b2f129afb903b421 /server/lib/live/live-utils.ts
parent508c1b1e9f3b26752a961e945b7fa59b72b30827 (diff)
downloadPeerTube-aa887096f9a305568dc3a846d0c9cdf7e45f1c67.tar.gz
PeerTube-aa887096f9a305568dc3a846d0c9cdf7e45f1c67.tar.zst
PeerTube-aa887096f9a305568dc3a846d0c9cdf7e45f1c67.zip
Correctly delete live files from object storage
Diffstat (limited to 'server/lib/live/live-utils.ts')
-rw-r--r--server/lib/live/live-utils.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/server/lib/live/live-utils.ts b/server/lib/live/live-utils.ts
index d2b8e3a55..c0dec9829 100644
--- a/server/lib/live/live-utils.ts
+++ b/server/lib/live/live-utils.ts
@@ -3,7 +3,7 @@ import { basename, join } from 'path'
3import { logger } from '@server/helpers/logger' 3import { logger } from '@server/helpers/logger'
4import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideo } from '@server/types/models' 4import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideo } from '@server/types/models'
5import { VideoStorage } from '@shared/models' 5import { VideoStorage } from '@shared/models'
6import { listHLSFileKeysOf, removeHLSFileObjectStorage, removeHLSObjectStorage } from '../object-storage' 6import { listHLSFileKeysOf, removeHLSFileObjectStorageByFullKey, removeHLSObjectStorage } from '../object-storage'
7import { getLiveDirectory } from '../paths' 7import { getLiveDirectory } from '../paths'
8 8
9function buildConcatenatedName (segmentOrPlaylistPath: string) { 9function buildConcatenatedName (segmentOrPlaylistPath: string) {
@@ -77,11 +77,13 @@ async function cleanupTMPLiveFilesFromFilesystem (video: MVideo) {
77async function cleanupTMPLiveFilesFromObjectStorage (streamingPlaylist: MStreamingPlaylistVideo) { 77async function cleanupTMPLiveFilesFromObjectStorage (streamingPlaylist: MStreamingPlaylistVideo) {
78 if (streamingPlaylist.storage !== VideoStorage.OBJECT_STORAGE) return 78 if (streamingPlaylist.storage !== VideoStorage.OBJECT_STORAGE) return
79 79
80 logger.info('Cleanup TMP live files from object storage for %s.', streamingPlaylist.Video.uuid)
81
80 const keys = await listHLSFileKeysOf(streamingPlaylist) 82 const keys = await listHLSFileKeysOf(streamingPlaylist)
81 83
82 for (const key of keys) { 84 for (const key of keys) {
83 if (isTMPLiveFile(key)) { 85 if (isTMPLiveFile(key)) {
84 await removeHLSFileObjectStorage(streamingPlaylist, key) 86 await removeHLSFileObjectStorageByFullKey(key)
85 } 87 }
86 } 88 }
87} 89}