async-redis icon indicating copy to clipboard operation
async-redis copied to clipboard

v2 completely broke several connections to single redis

Open a-parser opened this issue 4 years ago • 2 comments

Just abstract example:

(async f1() {
  const client1 = asyncRedis.createClient();
  await client1.blpop("some", 0);
})()

(async f2() {
  const client2 = asyncRedis.createClient();
  await client2.lpush("some", 42); 
})()

f2's lpush will never be called as client1 and client2 share same connection due to new implementation

a-parser avatar Jun 18 '21 10:06 a-parser

duplicated of #60 :p

micalevisk avatar Sep 06 '21 23:09 micalevisk

an workaround:

(async f1() {
  const client1 = asyncRedis.createClient({ _id: 1 });
  await client1.blpop("some", 0);
})()

(async f2() {
  const client2 = asyncRedis.createClient({ _id: 2 });
  await client2.lpush("some", 42); 
})()

you must pass different options for each client.

micalevisk avatar Sep 06 '21 23:09 micalevisk