denodrivers/redis

Ability to use xread and pipeline/tx in parallel

zifeo opened this issue · 1 comments

zifeo commented

This seems to only be a restriction/issue? with pipeline/tx, simple commands seem to work. Currently ends up in multiple errors: Invalid state, -ERR Protocol error: invalid multibulk length, raw.split is not a function or its return value is not iterable and similar.

const client = await newClient(opts);

// async
client.xread([{ key: "test", xid: 0 }], { block: 5000 });

const tx = client.pipeline();
tx.xadd("test", "*", {a: "a"}, { approx: true, elements: 10000 });
const resp = await tx.flush();

client.close();
zifeo commented

Note that simple commands will be delayed and cannot happen in parallel of xread "blocks". The workaround is to use two connections and might be worth clarifying in the documentation.