diff --git a/appstats.js b/appstats.js index 139a9b8..e50b642 100644 --- a/appstats.js +++ b/appstats.js @@ -9,7 +9,6 @@ */ const async = require('async'); -const util = require('util'); const moment = require('moment'); const parse = require('parse-key-value'); const azureStorage = require('azure-storage'); @@ -293,7 +292,16 @@ class AzureCollectionStats { return callback(); }); }, function() { - return processed < metadata.approximateMessageCount; + const cb = arguments[arguments.length - 1]; + const args = Array.prototype.slice.call(arguments, 0, arguments.length - 1); + const f = function() { + return processed < metadata.approximateMessageCount; + }; + try { + cb(null, f.apply(this, args)); + } catch (e) { + cb(e, null); + } }, function() { if (!resultError) { return callback(null, resultStats); diff --git a/package.json b/package.json index c0dacef..8b1210b 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ }, "dependencies": { "al-collector-js": "git://github.com/alertlogic/al-collector-js#master", - "async": "^2.6.1", + "async": "^3.0.0", "azure": "^2.3.1-preview", "parse-key-value": "^1.0.0", "path": "^0.12.7"