db index.js asserts removed for resilience

This commit is contained in:
tripathyr 2021-05-20 09:40:40 +05:30 committed by GitHub
parent bad1fb2552
commit 17dd83de10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,7 +50,6 @@ DB.prototype._onError = function(err) {
if (!this._stopping) {
log.error('Db Service: error: ' + err);
//FLO Crash Error Resolution by RanchiMall 10th May 2021
//return this.node.stop();
//this.node.stop();
}
};
@ -119,7 +118,9 @@ DB.prototype.get = function(key, options, callback) {
} else {
cb(new Error('Shutdown sequence underway, not able to complete the query'));
// FLOSight Error Correction from RanchiMall 20th May 2021.
//cb(new Error('Shutdown sequence underway, not able to complete the query'));
log.error('Shutdown sequence underway, not able to complete the query');
}
};
@ -130,11 +131,19 @@ DB.prototype.put = function(key, value, callback) {
callback();
}
assert(Buffer.isBuffer(key), 'key NOT a buffer as expected.');
// FLOSight Error Correction from RanchiMall 20th May 2021. removed the unhandled assert and replaced by looging of error
if (Buffer.isBuffer(key) == false) {
log.error('key NOT a buffer as expected.');
}
// assert(Buffer.isBuffer(key), 'key NOT a buffer as expected.');
if (value) {
assert(Buffer.isBuffer(value), 'value exists but NOT a buffer as expected.');
// FLOSight Error Correction from RanchiMall 20th May 2021. removed the unhandled assert and replaced by looging of error
if (Buffer.isBuffer(value) == false) {
log.error('value exists but NOT a buffer as expected.');
}
//assert(Buffer.isBuffer(value), 'value exists but NOT a buffer as expected.');
}
@ -149,11 +158,18 @@ DB.prototype.batch = function(ops, callback) {
for(var i = 0; i < ops.length; i++) {
assert(Buffer.isBuffer(ops[i].key), 'key NOT a buffer as expected.');
// FLOSight Error Correction from RanchiMall 20th May 2021. removed the unhandled assert and replaced by looging of error
if (Buffer.isBuffer(ops[i].key) == false) {
log.error('key NOT a buffer as expected.');
}
//assert(Buffer.isBuffer(ops[i].key), 'key NOT a buffer as expected.');
if (ops[i].value) {
assert(Buffer.isBuffer(ops[i].value), 'value exists but NOT a buffer as expected.');
// FLOSight Error Correction from RanchiMall 20th May 2021. removed the unhandled assert and replaced by looging of error
if (Buffer.isBuffer(ops[i].value) == false) {
log.error('value exists but NOT a buffer as expected.');
}
//assert(Buffer.isBuffer(ops[i].value), 'value exists but NOT a buffer as expected.');
}
}