|
|
|
@ -30,6 +30,11 @@ Logger.levels.forEach(function (level) {
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var DETAIL = 1000;
|
|
|
|
|
var round = function (n) {
|
|
|
|
|
return Math.floor(n * DETAIL) / DETAIL;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var ready = false;
|
|
|
|
|
var store;
|
|
|
|
|
var pinStore;
|
|
|
|
@ -231,11 +236,11 @@ const computeIndexFromOffset = function (channelName, offset, cb) {
|
|
|
|
|
Env.Log.info('WORKER_OFFSET_UPDATE', {
|
|
|
|
|
channel: channelName,
|
|
|
|
|
start: start,
|
|
|
|
|
startMB: start / 1024 / 1024,
|
|
|
|
|
startMB: round(start / 1024 / 1024),
|
|
|
|
|
update: new_start,
|
|
|
|
|
updateMB: new_start / 1024 / 1024,
|
|
|
|
|
updateMB: round(new_start / 1024 / 1024),
|
|
|
|
|
diff: diff,
|
|
|
|
|
diffMB: diff / 1024 / 1024,
|
|
|
|
|
diffMB: round(diff / 1024 / 1024),
|
|
|
|
|
});
|
|
|
|
|
}));
|
|
|
|
|
}).nThen(function () {
|
|
|
|
@ -269,7 +274,7 @@ const computeIndex = function (data, cb) {
|
|
|
|
|
Env.Log.verbose('WORKER_OFFSET_RECOVERY', {
|
|
|
|
|
channel: channelName,
|
|
|
|
|
start: start,
|
|
|
|
|
startMB: start / 1024 / 1024,
|
|
|
|
|
startMB: round(start / 1024 / 1024),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
@ -544,11 +549,13 @@ const evictInactive = function (data, cb) {
|
|
|
|
|
Eviction(Env, cb);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var reportStatus = function (Env, label, safeKey, err, id) {
|
|
|
|
|
var reportStatus = function (Env, label, safeKey, err, id, size) {
|
|
|
|
|
var data = {
|
|
|
|
|
safeKey: safeKey,
|
|
|
|
|
err: err && err.message || err,
|
|
|
|
|
id: id,
|
|
|
|
|
size: size,
|
|
|
|
|
sizeMB: round((size || 0) / 1024 / 1024),
|
|
|
|
|
};
|
|
|
|
|
var method = err? 'error': 'info';
|
|
|
|
|
Env.Log[method](label, data);
|
|
|
|
@ -559,6 +566,7 @@ const completeUpload = function (data, cb) {
|
|
|
|
|
var owned = data.owned;
|
|
|
|
|
var safeKey = data.safeKey;
|
|
|
|
|
var arg = data.arg;
|
|
|
|
|
var size = data.size;
|
|
|
|
|
|
|
|
|
|
var method;
|
|
|
|
|
var label;
|
|
|
|
@ -571,7 +579,7 @@ const completeUpload = function (data, cb) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Env.blobStore[method](safeKey, arg, function (err, id) {
|
|
|
|
|
reportStatus(Env, label, safeKey, err, id);
|
|
|
|
|
reportStatus(Env, label, safeKey, err, id, size);
|
|
|
|
|
cb(err, id);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|