Increase download parallelism.

This commit is contained in:
Vahagn Khachatryan
2018-12-05 17:37:36 +00:00
parent dc86d341f0
commit f5ad6d7d83

View File

@@ -53,7 +53,7 @@ class Book{
return fetch(url, {
credentials: 'include'
}).then((res) => {
console.log(`Downloaded.`)
// console.log(`Downloaded.`)
return res;
}, onError)
}
@@ -118,7 +118,7 @@ class Book{
.then((json) => {
return this.extractChapterAssets(json)
})
},{concurrency: 1}))
},{concurrency: 10}))
return Promise.all(downloads)
}
@@ -152,13 +152,12 @@ class Book{
return this.downloadResource(url)
.then((res) => {
if (res.ok){
console.log(res.headers.get('Content-Type'))
this.book_files[url].headers = res.headers
this.book_files[url].mime = res.headers.get('Content-Type')
this.book_files[url].body = res.blob()
}
})
},{concurrency: 1})
},{concurrency: 10})
}
insertBookFile(url, filename){