Increase download parallelism.
This commit is contained in:
@@ -53,7 +53,7 @@ class Book{
|
|||||||
return fetch(url, {
|
return fetch(url, {
|
||||||
credentials: 'include'
|
credentials: 'include'
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
console.log(`Downloaded.`)
|
// console.log(`Downloaded.`)
|
||||||
return res;
|
return res;
|
||||||
}, onError)
|
}, onError)
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ class Book{
|
|||||||
.then((json) => {
|
.then((json) => {
|
||||||
return this.extractChapterAssets(json)
|
return this.extractChapterAssets(json)
|
||||||
})
|
})
|
||||||
},{concurrency: 1}))
|
},{concurrency: 10}))
|
||||||
|
|
||||||
return Promise.all(downloads)
|
return Promise.all(downloads)
|
||||||
}
|
}
|
||||||
@@ -152,13 +152,12 @@ class Book{
|
|||||||
return this.downloadResource(url)
|
return this.downloadResource(url)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.ok){
|
if (res.ok){
|
||||||
console.log(res.headers.get('Content-Type'))
|
|
||||||
this.book_files[url].headers = res.headers
|
this.book_files[url].headers = res.headers
|
||||||
this.book_files[url].mime = res.headers.get('Content-Type')
|
this.book_files[url].mime = res.headers.get('Content-Type')
|
||||||
this.book_files[url].body = res.blob()
|
this.book_files[url].body = res.blob()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},{concurrency: 1})
|
},{concurrency: 10})
|
||||||
}
|
}
|
||||||
|
|
||||||
insertBookFile(url, filename){
|
insertBookFile(url, filename){
|
||||||
|
|||||||
Reference in New Issue
Block a user