From 3d3787b802c7e6e75f9782f1792950a4ecee4578 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 26 Mar 2015 14:25:56 +0530 Subject: [PATCH] timeout chunk requests after 5 minutes. try to avoid snap with setTimeout --- static/js/fs.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/static/js/fs.js b/static/js/fs.js index 921bd149..dfbe2a12 100644 --- a/static/js/fs.js +++ b/static/js/fs.js @@ -174,6 +174,7 @@ pandora.fs = (function() { xhr.setRequestHeader('Range', 'bytes=' + offset + '-' + end); xhr.withCredentials = true; xhr.responseType = 'blob'; + xhr.timeout = 1000 * 60 * 5; xhr.addEventListener('progress', function(event) { if (event.lengthComputable) { if (!total) { @@ -196,7 +197,9 @@ pandora.fs = (function() { if (offset + blobSize < total) { partialDownload(offset + blobSize + 1); } else { - that.storeBlob(new Blob(blobs), name, callback); + setTimeout() { + that.storeBlob(new Blob(blobs), name, callback); + }); } }); xhr.addEventListener('error', function (event) {