From df72723fb9276ca66584dee72e19092df1655bf5 Mon Sep 17 00:00:00 2001 From: luckydonald Date: Wed, 13 Aug 2014 13:18:24 +0200 Subject: [PATCH] Fixed "Any minute now" staying because of undefined buffer. Also increased buffer size to 20 to be less jittery. --- apps/files/js/file-upload.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 874e88ef1c..b43175da9a 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -444,10 +444,13 @@ OC.Upload = { //remaining time var lastUpdate = new Date().getMilliseconds(); var lastSize = 0; - var bufferSize = 10; - var buffer = new Array();// = new Array(bufferSize); + var bufferSize = 20; + var buffer = new Array(); var bufferIndex = 0; var bufferTotal = 0; + for(var i = 0; i < bufferSize;i++){ + buffer[i] = 0; + } // add progress handlers fileupload.on('fileuploadadd', function(e, data) { OC.Upload.log('progress handle fileuploadadd', e, data); @@ -481,7 +484,7 @@ OC.Upload = { diffSize = diffSize / diffUpdate; // apply timing factor, eg. 1mb/2s = 0.5mb/s var remainingSeconds = ((data.total - data.loaded) / diffSize); if(remainingSeconds>0){ //buffer to make it smoother - bufferTotal = bufferTotal - (buffer[bufferIndex]||0) + remainingSeconds; + bufferTotal = bufferTotal - (buffer[bufferIndex]) + remainingSeconds; buffer[bufferIndex] = remainingSeconds; bufferIndex = (bufferIndex + 1) % bufferSize; }