zuhao
zuhao

Reputation: 129

Why does redis-py's bgsave() command return False after successful execution?

When I fired redis-py's bgsave() command, the return value was False, but I'm pretty sure the execution was successful because I've checked with lastsave().

However, if I use save() the return value would be True after successful execution.

Could anyone please explain what False indicates for bgsave()? Not sure if it has anything to do with bgsave() being executed in the background.

Upvotes: 1

Views: 1012

Answers (1)

zuhao
zuhao

Reputation: 129

Thanks to Pavel Anossov, after reading the code of client.py, I found out that responses from 2 commands (BGSAVE and BGREWRITEAOF) were not converted from bytes to str, and this caused the problem in Python 3.

To fix this issue, just change lambda r: r == to lambda r: nativestr(r) == for these two commands in RESPONSE_CALLBACKS.

Upvotes: 2

Related Questions