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

Support timeout = 0 in search query #2934

Merged
merged 12 commits into from
Sep 14, 2023
Merged

Support timeout = 0 in search query #2934

merged 12 commits into from
Sep 14, 2023

Conversation

meiravgri
Copy link
Contributor

@meiravgri meiravgri commented Sep 12, 2023

In RediSearch query timeout = 0 means unlimited timeout. In the current implementation, the query timeout is only updated if timeout which in case of 0, translates to false. Since the default timeout of the query class is None, replacing the condition with if self._timeout is not None will also work for 0. If the parameter is not a positive integer, redis server will raise an exception.

related issue: #2839

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?
  • Was the change added to CHANGES file?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

Please provide a description of the change here.

In RediSearch query timeout = 0 means unlimited timeout.
In the current implementation, the query timeout is only updated `if timeout` which in case of 0, translates to false.
Since the default timeout of the `query` class is None, replacing the condition with `if self._timeout is not None` will also work for 0.
If the parameter is not a positive integer, redis server will raise an exception.

related issue: redis#2928 redis#2839
Copy link
Contributor

@GuyAv46 GuyAv46 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov-commenter
Copy link

codecov-commenter commented Sep 14, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01% ⚠️

Comparison is base (1596ac6) 91.28% compared to head (e5ca6e3) 91.27%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2934      +/-   ##
==========================================
- Coverage   91.28%   91.27%   -0.01%     
==========================================
  Files         126      126              
  Lines       32398    32400       +2     
==========================================
- Hits        29575    29574       -1     
- Misses       2823     2826       +3     
Files Changed Coverage Δ
redis/commands/search/query.py 93.54% <100.00%> (ø)
tests/test_search.py 73.42% <100.00%> (+0.03%) ⬆️

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dvora-h
Copy link
Collaborator

dvora-h commented Sep 14, 2023

closes #2839

@dvora-h dvora-h changed the title Support query timeout = 0 Support timeout = 0 in search query Sep 14, 2023
@dvora-h dvora-h merged commit 46b736e into redis:master Sep 14, 2023
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants