Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cb.remaining = 0;
for (var i = 0; i < ops.length; i++) {
var fnparams = ops[i];
var fn = fnparams.shift();
fnparams.push([cb, fn.name]);
fn.apply(cb, fnparams);
}
cb.remaining = i-1;
}
for (var i = 0; i < max_handles; i++) {
var cb = new driver.Couchbase(
"localhost:8091");
cb.id = i + 0;
var cberr = (function(iter) {
return function() {
console.log("Error handler for " + iter);
errorHandler.apply(this, arguments);
}
})(cb.id);
cb.on("error", cberr);
// Try to connect to the server
var clofn = function (cbv) {
return function() {
on_connect(cbv);
}
cbdata['data'] = [cb, fn.name];
cbdata['exp'] = Math.round(Math.random() * 1000);
fnparams.push(cbdata);
try {
fn.apply(cb, fnparams);
} catch(err) {
console.log("Error while executing %s: (%s)", fn.name, err);
}
}
cb.remaining = i-1;
}
for (var i = 0; i < max_handles; i++) {
var cb = new driver.Couchbase(
"localhost:8091"
);
cb._opCallStyle('dict');
cb.id = i + 0;
var cberr = (function(iter) {
return function() {
console.log("Error handler for " + iter);
errorHandler.apply(this, arguments);
}
})(cb.id);
cb.on("error", cberr);
console.log("Created new handle " + cb.id);
handles[i] = cb;
schedule_operations(cb);
console.log("Error while executing %s: (%s)", fn.name, err);
}
}
cb.remaining = i-1;
}
var schedfuncs = {
"dict" : schedule_operations_dict,
"positional" : schedule_operations_positional
};
for (var i = 0; i < max_handles; i++) {
var cb = new driver.Couchbase(
params.params["hostname"],
params.params["username"],
params.params["password"],
params.params["bucket"]
);
cb.id = i + 0;
var cberr = (function(iter) {
return function() {
console.log("Error handler for " + iter);
errorHandler.apply(this, arguments);
}
})(cb.id);
cb.on("error", cberr);
schedfuncs[params.params['callstyle']](cb);
exports.create_handle = function() {
var driver = require('couchbase');
exports.parse_cliargs();
var cb = new driver.Couchbase(
exports.params['hostname'],
exports.params['username'],
exports.params['password'],
exports.params['bucket']
);
return cb;
};