redis-py icon indicating copy to clipboard operation
redis-py copied to clipboard

Fixing #issue2592 - Assigning step_count value 1 if it's 0 when passing in range function

Open aksinha334 opened this issue 2 years ago • 5 comments

Pull Request check-list

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

  • [ ] Does $ tox pass with this change (including linting)?
  • [ ] 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. Fixing #2592 , assigning step_count value to 1 if it was 0 when passing in range function

aksinha334 avatar Mar 17 '23 03:03 aksinha334

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.03 :warning:

Comparison is base (66a4d6b) 92.28% compared to head (f936124) 92.26%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2623      +/-   ##
==========================================
- Coverage   92.28%   92.26%   -0.03%     
==========================================
  Files         115      115              
  Lines       29787    29795       +8     
==========================================
+ Hits        27489    27490       +1     
- Misses       2298     2305       +7     
Impacted Files Coverage Δ
redis/commands/parser.py 64.13% <100.00%> (+0.79%) :arrow_up:
tests/test_command_parser.py 94.54% <100.00%> (+0.66%) :arrow_up:

... and 3 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Mar 17 '23 03:03 codecov-commenter

Hi, @dvora-h @shacharPash, I have added the test and the check is passing, can you please review the PR?

I've just added the code to make sure range builtin function's parameter step is not getting 0. so making it 1 when it's 0.

aksinha334 avatar Mar 17 '23 16:03 aksinha334

Hey @aksinha334, Maybe try adding the code sample from the issue to the tests to show that the issue has been resolved

shacharPash avatar Mar 26 '23 01:03 shacharPash

Hi @shacharPash ,

I've created the container using "invoke devenv", and using port 16379 for cluster mode, but when I'm running the code, it's throwing the below error redis.exceptions.RedisClusterException: No way to dispatch this command to Redis Cluster. Missing key. You can execute the command by specifying target nodes. Command: ('CLIENT TRACKING', 'ON', 'REDIRECT', 51, 'PREFIX', 'foo', 'BCAST')

sorry, I searched on the internet but didn't get any solution, do you have any idea or link about the missing key error so I can proceed further? any help will be great as I'm new to this codebase.

A snippet of code: `

client1 = cluster.RedisCluster.from_url('redis://localhost:16379/0')
id = client1.client_id()

pubsub = client1.pubsub()
pubsub.subscribe(**{'__redis__:invalidate': handler})
pubsub.run_in_thread(daemon=True, sleep_time=None)

client1.client_tracking_on(clientid=id, prefix=['foo'], bcast=True)

client1.get('fooASF')
for i in range(10):
    client1.set('fooASF', '23423423ff')

time.sleep(100)

`

aksinha334 avatar Mar 28 '23 16:03 aksinha334

@aksinha334 did you manage to setup the setup a working test?

matejsp avatar Mar 16 '24 06:03 matejsp