Open moznuy opened 2 years ago
OK, maybe there is more important problem here: https://github.com/redis/redis-om-python/blob/00ed537fcaf43d93ea26e0332d5cb2f1a4c1c4a1/aredis_om/checks.py#L13-L14
I think lru_cache caches coroutine creation, doesn't it?
So it is always not <coroutine object>
here https://github.com/redis/redis-om-python/blob/00ed537fcaf43d93ea26e0332d5cb2f1a4c1c4a1/aredis_om/model/model.py#L1468-L1474
and more over, this:
from functools import lru_cache
@lru_cache(maxsize=None)
async def has_redis_json():
return False
print(type(has_redis_json()))
print(not has_redis_json())
returns:
<class 'coroutine'>
False
sys:1: RuntimeWarning: coroutine 'has_redis_json' was never awaited
Which is exactly expected
(I spent a lot of time to get this warning from aredis_om.JsonModel().__init__()
but could not for some reason)
So you won't see logging.error from redis-om ever
I think it should always be sync check in init (with lru_cache).
Or somewhere else entirely?
Or I simply missing something between aredis_om <-> redis_om import connections or some magic?
And what if user uses async API:
Model would get async connection, then the check that should be sync(because in __init__
) gets async connection...
Either we create async and sync Redis instance in metaclass instead of only 1. (which is bad?)
Or maybe check might go to the place where async and sync is a part of protocol instead of __init__
, which is always sync,
like execute()
in FindQuery
or save()
, get()
in JsonModel
When testing with
make test_oss
we getTypeError: 'NoneType' object is not subscriptable
with Traceback in redis-py not in redis-om:You can replicate this against redis:latest with
There is a problem in redis-py with parsing the response from redis. (It's nill) Maybe it's related to: https://github.com/redis/redis-py/blob/09a52dba48221353eafa8188d73ab97e8f4ccc49/redis/commands/core.py#L740-L743
So when I try to use redis-om against
redis:latest
:I get this:
instead of https://github.com/redis/redis-om-python/blob/00ed537fcaf43d93ea26e0332d5cb2f1a4c1c4a1/aredis_om/model/model.py#L347-L352
So maybe we can test with
here https://github.com/redis/redis-om-python/blob/00ed537fcaf43d93ea26e0332d5cb2f1a4c1c4a1/aredis_om/checks.py#L14 and something similar for RediSearch here https://github.com/redis/redis-om-python/blob/00ed537fcaf43d93ea26e0332d5cb2f1a4c1c4a1/aredis_om/checks.py#L22