forked from 0x2620/pandora
timeout chunk requests after 5 minutes. try to avoid snap with setTimeout
This commit is contained in:
parent
1d2675ab97
commit
3d3787b802
1 changed files with 4 additions and 1 deletions
|
@ -174,6 +174,7 @@ pandora.fs = (function() {
|
||||||
xhr.setRequestHeader('Range', 'bytes=' + offset + '-' + end);
|
xhr.setRequestHeader('Range', 'bytes=' + offset + '-' + end);
|
||||||
xhr.withCredentials = true;
|
xhr.withCredentials = true;
|
||||||
xhr.responseType = 'blob';
|
xhr.responseType = 'blob';
|
||||||
|
xhr.timeout = 1000 * 60 * 5;
|
||||||
xhr.addEventListener('progress', function(event) {
|
xhr.addEventListener('progress', function(event) {
|
||||||
if (event.lengthComputable) {
|
if (event.lengthComputable) {
|
||||||
if (!total) {
|
if (!total) {
|
||||||
|
@ -196,7 +197,9 @@ pandora.fs = (function() {
|
||||||
if (offset + blobSize < total) {
|
if (offset + blobSize < total) {
|
||||||
partialDownload(offset + blobSize + 1);
|
partialDownload(offset + blobSize + 1);
|
||||||
} else {
|
} else {
|
||||||
|
setTimeout() {
|
||||||
that.storeBlob(new Blob(blobs), name, callback);
|
that.storeBlob(new Blob(blobs), name, callback);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
xhr.addEventListener('error', function (event) {
|
xhr.addEventListener('error', function (event) {
|
||||||
|
|
Loading…
Reference in a new issue