X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=scripts%2Fupdate-host.ts;h=ed8b999a9f42c8d43a24e2a1b9b0e1425b3a0516;hb=379acb21bcc491efdc0118ea714790bb34238d66;hp=4551a4702aac0243c1fc1badf9319d1ad5794fd6;hpb=50d6de9c286abcb34ff4234d56d9cbb803db7665;p=github%2FChocobozzz%2FPeerTube.git diff --git a/scripts/update-host.ts b/scripts/update-host.ts index 4551a4702..ed8b999a9 100755 --- a/scripts/update-host.ts +++ b/scripts/update-host.ts @@ -1,4 +1,4 @@ -import { getServerActor } from '../server/helpers' +import { getServerActor } from '../server/helpers/utils' import { initDatabaseModels } from '../server/initializers' import { ActorFollowModel } from '../server/models/activitypub/actor-follow' import { VideoModel } from '../server/models/video/video' @@ -22,18 +22,13 @@ initDatabaseModels(true) console.log('Updating torrent files.') return VideoModel.list() }) - .then(videos => { - const tasks: Promise[] = [] - - videos.forEach(video => { - console.log('Updating video ' + video.uuid) - - video.VideoFiles.forEach(file => { - tasks.push(video.createTorrentAndSetInfoHash(file)) - }) - }) - - return Promise.all(tasks) + .then(async videos => { + for (const video of videos) { + for (const file of video.VideoFiles) { + await video.createTorrentAndSetInfoHash(file) + console.log('Updated video ' + video.uuid) + } + } }) .then(() => { process.exit(0)