should I check error each step on a redis multi transaction? if some error happen, was it mean, the release command will also return error?
eg. can I :
conn.Do("multi")
conn.Do("set", "mm", "xx")
reply, err := conn.Do("exec")
if err != nil {
....
}
or, should i :
_, err := conn.Do("multi")
if err != nil {
....
return
}
_, err := conn.Do("set", "mm", "xx")
if err != nil {
....
return
}
reply, err := conn.Do("exec")
if err != nil {
....
return
}
To transact, you need to Send()
each command, and only Do()
the EXEC. Error checking should be done for the Do()
only, like so:
conn.Send("MULTI")
conn.Send("SET", "foo", "bar")
...
reply, err := conn.Do("EXEC")
if err != nil {
...
}
...