Coroutine 'has_redisearch' was never awaited
khiemdoan opened this issue · comments
Khiem Doan commented
I got this error without any detail or trace stack:
sys:1: RuntimeWarning: coroutine 'has_redisearch' was never awaited
I commented out these lines in aredis_om/model/model.py
and my code run as I expected:
redis-om-python/aredis_om/model/model.py
Lines 358 to 363 in 87d3a08
# if not has_redisearch(model.db()):
# raise RedisModelError(
# "Your Redis instance does not have either the RediSearch module "
# "or RedisJSON module installed. Querying requires that your Redis "
# "instance has one of these modules installed."
# )
Yair Bonastre commented
that is because the __init__()
in the class is synchronous but the has_redissearch()
method is async.
A way to solve it would either change the class to have an async instance or to run that function using asyncio.run()
check this source for more info.
https://stackoverflow.com/questions/33128325/how-to-set-class-attribute-with-await-in-init