mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Fix prune storage tests
This commit is contained in:
parent
29b7426c67
commit
52fb1d97ba
@ -6,7 +6,7 @@ import { updatePlaylistMiniatureFromUrl } from '@server/lib/thumbnail'
|
|||||||
import { VideoPlaylistModel } from '@server/models/video/video-playlist'
|
import { VideoPlaylistModel } from '@server/models/video/video-playlist'
|
||||||
import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'
|
import { VideoPlaylistElementModel } from '@server/models/video/video-playlist-element'
|
||||||
import { FilteredModelAttributes } from '@server/types'
|
import { FilteredModelAttributes } from '@server/types'
|
||||||
import { MAccountDefault, MAccountId, MVideoPlaylist, MVideoPlaylistFull } from '@server/types/models'
|
import { MAccountDefault, MAccountId, MThumbnail, MVideoPlaylist, MVideoPlaylistFull } from '@server/types/models'
|
||||||
import { AttributesOnly } from '@shared/core-utils'
|
import { AttributesOnly } from '@shared/core-utils'
|
||||||
import { PlaylistObject } from '@shared/models'
|
import { PlaylistObject } from '@shared/models'
|
||||||
import { getOrCreateAPActor } from '../actors'
|
import { getOrCreateAPActor } from '../actors'
|
||||||
@ -54,11 +54,7 @@ async function createOrUpdateVideoPlaylist (playlistObject: PlaylistObject, byAc
|
|||||||
// Refetch playlist from DB since elements fetching could be long in time
|
// Refetch playlist from DB since elements fetching could be long in time
|
||||||
const playlist = await VideoPlaylistModel.loadWithAccountAndChannel(upsertPlaylist.id, null)
|
const playlist = await VideoPlaylistModel.loadWithAccountAndChannel(upsertPlaylist.id, null)
|
||||||
|
|
||||||
try {
|
await updatePlaylistThumbnail(playlistObject, playlist)
|
||||||
await updatePlaylistThumbnail(playlistObject, playlist)
|
|
||||||
} catch (err) {
|
|
||||||
logger.warn('Cannot update thumbnail of %s.', playlistObject.id, { err, ...lTags(playlistObject.id, playlist.uuid, playlist.url) })
|
|
||||||
}
|
|
||||||
|
|
||||||
return rebuildVideoPlaylistElements(playlistElementUrls, playlist)
|
return rebuildVideoPlaylistElements(playlistElementUrls, playlist)
|
||||||
}
|
}
|
||||||
@ -98,8 +94,16 @@ async function fetchElementUrls (playlistObject: PlaylistObject) {
|
|||||||
|
|
||||||
async function updatePlaylistThumbnail (playlistObject: PlaylistObject, playlist: MVideoPlaylistFull) {
|
async function updatePlaylistThumbnail (playlistObject: PlaylistObject, playlist: MVideoPlaylistFull) {
|
||||||
if (playlistObject.icon) {
|
if (playlistObject.icon) {
|
||||||
const thumbnailModel = await updatePlaylistMiniatureFromUrl({ downloadUrl: playlistObject.icon.url, playlist })
|
let thumbnailModel: MThumbnail
|
||||||
await playlist.setAndSaveThumbnail(thumbnailModel, undefined)
|
|
||||||
|
try {
|
||||||
|
thumbnailModel = await updatePlaylistMiniatureFromUrl({ downloadUrl: playlistObject.icon.url, playlist })
|
||||||
|
await playlist.setAndSaveThumbnail(thumbnailModel, undefined)
|
||||||
|
} catch (err) {
|
||||||
|
logger.warn('Cannot set thumbnail of %s.', playlistObject.id, { err, ...lTags(playlistObject.id, playlist.uuid, playlist.url) })
|
||||||
|
|
||||||
|
if (thumbnailModel) await thumbnailModel.removeThumbnail()
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import {
|
|||||||
flushAndRunMultipleServers,
|
flushAndRunMultipleServers,
|
||||||
getAccount,
|
getAccount,
|
||||||
getEnvCli,
|
getEnvCli,
|
||||||
|
killallServers,
|
||||||
makeGetRequest,
|
makeGetRequest,
|
||||||
ServerInfo,
|
ServerInfo,
|
||||||
setAccessTokensToServers,
|
setAccessTokensToServers,
|
||||||
@ -116,6 +117,9 @@ describe('Test prune storage scripts', function () {
|
|||||||
await wait(1000)
|
await wait(1000)
|
||||||
|
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
killallServers(servers)
|
||||||
|
|
||||||
|
await wait(1000)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should have the files on the disk', async function () {
|
it('Should have the files on the disk', async function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user