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

Update to redis-rb 3.1.0; replace #unknown_items transaction with a script #21

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

hannahwhy
Copy link
Member

This PR gets the tracker on redis-rb 3.1.0 (i.e. latest stable release), and updates all Redis code to match. Updating to the latest release made implementing the changes for #20 much easier. These changes make the tracker spec pass using redis-rb 3.1.0.

This PR also replaces the multi block in Transactions#unknown_items with a script, because that was one transaction I thought would be clearer as a script. AFAICT, the script has exactly the same effect and offers the same atomicity guarantees.

I want this for weighted upload targets because script support in
redis-rb ~> 3.0 is much improved over the 2.x series.

However, some changes were required.  The changes reflected in this
commit:

1. Redis::Client#sismember returns true or false, not 1 or 0.
2. Redis::Client#sadd with a single item returns true or false, not
   1 or 0.  (Redis::Client#add with multiple items returns the
   number of items added.)
3. Redis::Client#hgetall now returns a Hash.
4. Redis::Client#zrange with with_scores set to true now returns an
   Array of Arrays, not a single Array with interleaved items and
   scores.
5. Redis::Client#eval now counts keys and argv length; there is no
   longer a need to explicitly specify the number of keys.

Finally, I replaced Tracker#unknown_items with a script because I
didn't want to mess about with the previous pipeline.
@hannahwhy
Copy link
Member Author

It looks like the Cucumber scenarios are failing. They've been failing for a while, but I'll see if I can get them back up.

@chfoo
Copy link
Member

chfoo commented Dec 17, 2014

If you didn't see it yet, I fixed the scenarios.

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 this pull request may close these issues.

2 participants