Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function from_client_to_server (message, argv) {
message.id = argv[0]
let com = argv[1]
let param = argv.slice(2)
console.log(param)
let command = new class_redis_command(com, param, // {},
{
replyEncoding: 'utf8'
},
function (error, result) {
console.log(':::', typeof result, result, arguments.length)
from_server_to_client(message, result)
for (var i = 0; i < arguments.length; i++) {
console.log(i, '--------:' + arguments[i])
}
})
server.redis_server.sendCommand(command)
}
function unwrap() {
if (process.env.IOPIPE_TRACE_IOREDIS_INITPROMISE) {
shimmer.unwrap(Redis.Command && Redis.Command.prototype, 'initPromise');
}
shimmer.unwrap(Redis && Redis.prototype, 'sendCommand');
delete Redis.__iopipeShimmer;
}
RedisKeyValueConnector.prototype.execute = function(command, args, cb) {
if (cb === undefined && typeof args === 'function') {
cb = args;
args = [];
}
assert(typeof command === 'string', 'command must be a string');
assert(typeof cb === 'function', 'callback must be a function');
command = command.toLowerCase();
debug('EXECUTE %j %j', command, args);
const cmd = new Redis.Command(command, args, 'utf8', function(err, result) {
debug('RESULT OF %j -- %j', command, result);
cb(err, result);
});
this._client.sendCommand(cmd);
};
function wrap({ timeline, data = {} } = {}) {
if (!(timeline instanceof Perf)) {
debug(
'Timeline passed to plugins/ioredis.wrap not an instance of performance-node. Skipping.'
);
return false;
}
if (!Redis.__iopipeShimmer) {
if (process.env.IOPIPE_TRACE_IOREDIS_INITPROMISE) {
shimmer.wrap(
Redis.Command && Redis.Command.prototype,
'initPromise',
wrapPromise
);
}
shimmer.wrap(Redis && Redis.prototype, 'sendCommand', wrapSendCommand);
Redis.__iopipeShimmer = true;
}
return true;
function wrapPromise(original) {
return function wrappedPromise() {
const command = this;
const cb = this.callback;
const id = createId();
const { name } = command;