aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-03-20 08:54:24 +0100
committerChocobozzz <me@florianbigard.com>2018-03-20 09:19:05 +0100
commitc91de74372432dee446bf837121ff40359185f4e (patch)
treeddc9c3221372f5926199564cb90863e1f6fe2507
parent07aa93a8f2580742b3acfbf39c025a3f53bb498e (diff)
downloadPeerTube-c91de74372432dee446bf837121ff40359185f4e.tar.gz
PeerTube-c91de74372432dee446bf837121ff40359185f4e.tar.zst
PeerTube-c91de74372432dee446bf837121ff40359185f4e.zip
Improve update host script
-rwxr-xr-xscripts/update-host.ts19
1 files changed, 7 insertions, 12 deletions
diff --git a/scripts/update-host.ts b/scripts/update-host.ts
index 3fb5f1972..ed8b999a9 100755
--- a/scripts/update-host.ts
+++ b/scripts/update-host.ts
@@ -22,18 +22,13 @@ initDatabaseModels(true)
22 console.log('Updating torrent files.') 22 console.log('Updating torrent files.')
23 return VideoModel.list() 23 return VideoModel.list()
24 }) 24 })
25 .then(videos => { 25 .then(async videos => {
26 const tasks: Promise<any>[] = [] 26 for (const video of videos) {
27 27 for (const file of video.VideoFiles) {
28 videos.forEach(video => { 28 await video.createTorrentAndSetInfoHash(file)
29 console.log('Updating video ' + video.uuid) 29 console.log('Updated video ' + video.uuid)
30 30 }
31 video.VideoFiles.forEach(file => { 31 }
32 tasks.push(video.createTorrentAndSetInfoHash(file))
33 })
34 })
35
36 return Promise.all(tasks)
37 }) 32 })
38 .then(() => { 33 .then(() => {
39 process.exit(0) 34 process.exit(0)