From ea6245ace4a05cd4a18d66c1f93e1ef43a78f9eb Mon Sep 17 00:00:00 2001 From: Simo Kinnunen Date: Fri, 4 Apr 2014 18:10:43 +0900 Subject: [PATCH] Faster progress. --- lib/roles/device/plugins/install.js | 4 ++-- lib/roles/storage/temp.js | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/roles/device/plugins/install.js b/lib/roles/device/plugins/install.js index ca456548..c621acd4 100644 --- a/lib/roles/device/plugins/install.js +++ b/lib/roles/device/plugins/install.js @@ -97,12 +97,12 @@ module.exports = syrup.serial() sendProgress('installing_app', guesstimate) return promiseutil.periodicNotify( adb.installRemote(options.serial, apk) - , 1000 + , 250 ) .progressed(function() { guesstimate = Math.min( end - , guesstimate + 5 * (end - guesstimate) / (end - start) + , guesstimate + 1.5 * (end - guesstimate) / (end - start) ) sendProgress('installing_app', guesstimate) }) diff --git a/lib/roles/storage/temp.js b/lib/roles/storage/temp.js index b4be7de5..99d50d10 100644 --- a/lib/roles/storage/temp.js +++ b/lib/roles/storage/temp.js @@ -101,7 +101,9 @@ module.exports = function(options) { }) try { - var req = progress(request(url)) + var req = progress(request(url), { + throttle: 100 // Throttle events, not upload speed + }) .on('progress', progressListener) var save = req.pipe(fs.createWriteStream(path))