drop chechChannelIntegrity API

This commit is contained in:
ansuz 2019-09-04 14:38:44 +02:00
parent f8cd1dc266
commit 702c9a2fb2

View file

@ -1,5 +1,5 @@
/* jshint esversion: 6 */
/* global Buffer, process */
/* global Buffer */
;(function () { 'use strict';
const nThen = require('nthen');
@ -1024,33 +1024,6 @@ module.exports.create = function (cfg) {
}
};
var cciLock = false;
const checkChannelIntegrity = function (ctx) {
if (process.env['CRYPTPAD_DEBUG'] && !cciLock) {
let nt = nThen;
cciLock = true;
Object.keys(ctx.channels).forEach(function (channelName) {
const chan = ctx.channels[channelName];
if (!chan.index) { return; }
nt = nt((waitFor) => {
store.getChannelSize(channelName, waitFor((err, size) => {
if (err) {
return void Log.debug("HK_CHECK_CHANNEL_INTEGRITY",
"Couldn't get size of channel " + channelName);
}
if (size !== chan.index.size) {
return void Log.debug("HK_CHECK_CHANNEL_SIZE",
"channel size mismatch for " + channelName +
" --- cached: " + chan.index.size +
" --- fileSize: " + size);
}
}));
}).nThen;
});
nt(() => { cciLock = false; });
}
};
return {
id: HISTORY_KEEPER_ID,
setConfig: setConfig,
@ -1058,7 +1031,6 @@ module.exports.create = function (cfg) {
dropChannel: dropChannel,
checkExpired: checkExpired,
onDirectMessage: onDirectMessage,
checkChannelIntegrity: checkChannelIntegrity
};
};