mirror of
https://github.com/Tusko/vimeo-private-downloader.git
synced 2025-08-20 21:34:03 -07:00
Merge pull request #21 from felipeands/master
feat: auto retry on download timeout
This commit is contained in:
commit
c103351cc2
1 changed files with 6 additions and 1 deletions
|
@ -107,7 +107,7 @@ function combineSegments(type, i, segmentsUrl, output, filename, downloadingFlag
|
|||
`Downloading ${type} segment ${i}/${segmentsUrl.length} of ${filename}`
|
||||
);
|
||||
|
||||
https
|
||||
let req = https
|
||||
.get(segmentsUrl[i], res => {
|
||||
res.on("data", d => output.write(d));
|
||||
|
||||
|
@ -118,6 +118,11 @@ function combineSegments(type, i, segmentsUrl, output, filename, downloadingFlag
|
|||
.on("error", e => {
|
||||
cb(e);
|
||||
});
|
||||
|
||||
req.setTimeout(7000, function () {
|
||||
log("⚠️", 'Timeout. Retrying');
|
||||
combineSegments(type, i, segmentsUrl, output, filename, downloadingFlag, cb);
|
||||
});
|
||||
}
|
||||
|
||||
function getJson(url, cb) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue