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