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

RediSearch: search command doesn't support asyncio Pipeline #2279

Closed
alancleary opened this issue Jul 14, 2022 · 0 comments · Fixed by #2316
Closed

RediSearch: search command doesn't support asyncio Pipeline #2279

alancleary opened this issue Jul 14, 2022 · 0 comments · Fixed by #2316

Comments

@alancleary
Copy link

The RediSearch search command returns an instance of the Result class except when the Redis client is a Pipeline because Pipeline returns itself instead of a result when you execute a command. There's code that checks for this in both the SearchCommands and AsyncSearchCommands classes:

if isinstance(res, Pipeline):

if isinstance(res, Pipeline):

However, this check doesn't work if the Pipeline is from the redis.asyncio.client module. The following modification should fix the issue:

from redis.client import Pipeline
from redis.asyncio.client import Pipeline as AsyncPipeline
...
        if isinstance(res, Pipeline) or isinstance(res, AsyncPipeline):
            return res
...

I'm not sure if it makes sense to check for both Pipeline types or if the SearchCommands class should check for just Pipeline and the AsyncSearchCommands class should check for just AsyncPipeline. Let me know and I can make a PR. Or feel free to make the changes yourself if that's easier. Thanks!

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

Successfully merging a pull request may close this issue.

1 participant