-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ioRedis support #57
base: master
Are you sure you want to change the base?
Conversation
Woah, this has been totally abandoned, a shame, really :( |
Hello, can we merge it to latest version? It's very usefull |
We moved to |
A workaround using new RSMQ({
client: new Proxy(ioredisClient, {
get(target, key, receiver) {
if (key === 'constructor') {
return { name: 'RedisClient' };
}
if (key === 'connected') {
return target.status === 'ready';
}
if (key === 'multi') {
// Note that `multi` proxy is minimal wrapping for RSMQ.
return new Proxy(target[key], {
apply(target, thisArg, argArray) {
return new Proxy(target.apply(thisArg, argArray), {
get(target2, key2, receiver2) {
if (key2 === 'exec') {
return (cb) => {
target2.exec((err, res) => {
cb(
err,
res
? res.map(([err, val]) => {
if (err) {
throw err;
}
return val;
})
: res
);
});
};
} else {
return target2[key2];
}
}
});
}
});
} else {
return target[key];
}
}
})
}) |
Hi rokoroku, |
@edima77 Proxy is Part of ECMAScript 2015 and according to MDN it is supported sinde node 6.x. Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy |
I've updated this PR to the current version of RSMQ. It passes all the same tests with both |
Hmm, is there still no support for ioredis in rsmq? |
Hi @smrchy,
This commit is a minimally invasive first-pass attempt at adding ioRedis support.
The main difference between ioredis and node-redis that affects rsmq is the difference in the return result from the
multi
function. This patch works around that by translating the ioredis response format to the node-redis format. It passes all the same node-redis test cases when using ioRedis, and is working with the application I'm developing.Please let me know what you think about this approach. I'd like to get this (or some similar patch that adds ioredis support) upstreamed if at all possible.