Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}, function (err, responseB, bodyB) {
if (err) {
console.log("ENVIRONMENT: COUCHBASE",endPoint, "NOT RESPONDING");
if (config.application.verbose) {
console.log("--↳ VERBOSE:ERR", err);
}
done(false);
return;
}
if(responseB.statusCode!=404) {
if (parseInt(JSON.parse(bodyB).basicStats.itemCount) > config.couchbase.thresholdItemCount) {
myBucket = myCluster.openBucket(bucket);
db = myBucket;
ODMBucket = myCluster.openBucket(bucket);
ottoman.store.bucket = ODMBucket;
// console.log("ENVIRONMENT: SERVICES: CHECK INDEXES ONLINE");
query("CREATE INDEX temp ON `" + config.couchbase.bucket + "`(non) USING " + config.couchbase.indexType,
function (err, res) {
if (err) {
console.log("ENVIRONMENT: INDEX QUERY NOT RESPONDING");
done(false);
return;
}
if (res) {
query('SELECT COUNT(*) FROM system:indexes WHERE state="online"',
function (err, onlineCount) {
if (err) {
console.log("ENVIRONMENT: INDEX QUERY NOT RESPONDING");
done(false);
return;
}