mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Correctly delete live files from object storage
This commit is contained in:
parent
508c1b1e9f
commit
aa887096f9
9 changed files with 69 additions and 23 deletions
|
@ -3,7 +3,7 @@ import { basename, join } from 'path'
|
|||
import { logger } from '@server/helpers/logger'
|
||||
import { MStreamingPlaylist, MStreamingPlaylistVideo, MVideo } from '@server/types/models'
|
||||
import { VideoStorage } from '@shared/models'
|
||||
import { listHLSFileKeysOf, removeHLSFileObjectStorage, removeHLSObjectStorage } from '../object-storage'
|
||||
import { listHLSFileKeysOf, removeHLSFileObjectStorageByFullKey, removeHLSObjectStorage } from '../object-storage'
|
||||
import { getLiveDirectory } from '../paths'
|
||||
|
||||
function buildConcatenatedName (segmentOrPlaylistPath: string) {
|
||||
|
@ -77,11 +77,13 @@ async function cleanupTMPLiveFilesFromFilesystem (video: MVideo) {
|
|||
async function cleanupTMPLiveFilesFromObjectStorage (streamingPlaylist: MStreamingPlaylistVideo) {
|
||||
if (streamingPlaylist.storage !== VideoStorage.OBJECT_STORAGE) return
|
||||
|
||||
logger.info('Cleanup TMP live files from object storage for %s.', streamingPlaylist.Video.uuid)
|
||||
|
||||
const keys = await listHLSFileKeysOf(streamingPlaylist)
|
||||
|
||||
for (const key of keys) {
|
||||
if (isTMPLiveFile(key)) {
|
||||
await removeHLSFileObjectStorage(streamingPlaylist, key)
|
||||
await removeHLSFileObjectStorageByFullKey(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue