Skip to content

Pipelined commands and MULTI/EXEC does not always return a list with answers #11

@behe

Description

@behe

Redix.pipeline and MULTI/EXEC currently returns a list when executing multiple commands but only a single answer when executing a single command. I found this quite surprising, ex:

commands = [
  ["SET", "pipe", "10"],
  ["INCR", "pipe"],
  ["GET", "pipe"]
]
Redix.pipeline(conn, commands)
=> {:ok, ["OK", 11, "11"]}

Redix.pipeline(conn, [["SET", "pipe_single", "10"]])
=> {:ok, "OK"}

Expected {:ok, ["OK"]} for last command.

Same for MULTI/EXEC:

Redix.command(conn, ["MULTI"])
=> {:ok, "OK"}
Redix.command(conn, ["INCR", "multifoo"])
=> {:ok, "QUEUED"}
Redix.command(conn, ["INCR", "multibar"])
=> {:ok, "QUEUED"}
Redix.command(conn, ["INCRBY", "multifoo", 4])
=> {:ok, "QUEUED"}
Redix.command(c, ["EXEC"])
=> {:ok, [1, 1, 5]}

Redix.command(conn, ["MULTI"])
=> {:ok, "OK"}
Redix.command(conn, ["SET", "multifoo", "10"])
=> {:ok, "QUEUED"}
Redix.command(c, ["EXEC"])
=> {:ok, "OK"}

Expected {:ok, ["OK"]} for last command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions