Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coroutine 'has_redisearch' was never awaited #531

Open
khiemdoan opened this issue Jul 1, 2023 · 1 comment
Open

Coroutine 'has_redisearch' was never awaited #531

khiemdoan opened this issue Jul 1, 2023 · 1 comment

Comments

@khiemdoan
Copy link

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:

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."
)

# 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."
#     )
@bonastreyair
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants