Closed ninoseki closed 1 year ago
Are you sure this is an issue with arq? Looks like it could be the redis package causing the error.
To be honest, I'm not sure. So sorry if it is a false flag. I try to reproduce the issue with redis & hiredis but I cannot. So I guess that it may be an issue on arq side.
I think worth reporting on the redis-py
project - it's pretty deep in their code.
Ok thanks I will do that. Sorry for taking your time.
No problem, happy to leave this open and you can link to this issue when you create one on redis-py
.
Did you create an issue in redis-py?😊
Sorry for being late/lazy. I try to create an issue with reproducible steps. But I'm failing for that. (Maybe it is an issue on a Redis server I use)
Hmm, I cannot reproduce the issue with the official Reids container image. So I'd like to conclude that this is a false flag. Sorry for taking your time. I have to investigate more before submitting the issue. My bad.
As a note, I think this is an issue on a Redis server I use, and I applied a dirty patch to mitigate the issue.
from typing import cast
from arq import ArqRedis
from redis.utils import str_if_bytes
def int_or_ok(response: int | str | bytes) -> int:
try:
return int(response)
except ValueError:
pass
if str_if_bytes(response) == "OK":
return 1
return 0
async def startup(ctx: dict) -> None:
redis = cast(ArqRedis, ctx["redis"])
redis.set_response_callback("DEL", int_or_ok)
No worries, thanks for reporting back 😊
Hello, thanks for creating & maitaning this great library. Recently have ValuError issue occasionally. So Let me report.
Environment
Error
Not always but sometimes the following ValueError happens
This error happens when executing
DEL
command.