denodrivers / redis

🦕 Redis client for Deno 🍕

Home Page:https://deno.land/x/redis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to use xread and pipeline/tx in parallel

zifeo opened this issue · comments

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();

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.