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

Do not build keys on lua scripts #348

Merged
merged 2 commits into from
Nov 19, 2018

Conversation

pacoguzman
Copy link
Contributor

Problem

Our one of our projects we're using redis-namespace which below 2.0 try to implicitly namespace keys transparently.

For example for script calls it does the following as an example:

https://github.com/resque/redis-namespace/blob/30d42177d8abfdf89e502c1a98aab7d923c2a133/lib/redis/namespace.rb#L372

Well, we're going to evaluate keeping using redis-namespace on the future, but we cannot afford the migration right now, and we realized that we cannot make use of the new conflict resolution features because of this:

local queue = "queue:" .. KEYS[1]

As it's going to build a string just like queue:default when in our redis service should be app_name:queue:default

Solution

We provided a slightly change so the ruby code provides which it thinks is the whole key to search for jobs then redis-namespace will add the namespace transparently.

Please let me know what you think, maybe we should add some kind of not on README about the redis-namespace usage or any other thing to clarify the previous situation and if this is accepted in some way evaluate if it's correct or not.

@pacoguzman pacoguzman force-pushed the add-redis-namespace-support branch 3 times, most recently from f01f1fe to bea25a8 Compare November 13, 2018 19:32
On this way users of sidekiq-unique-jobs that made use of redis-namespace < 2.0 could use it.
@pacoguzman pacoguzman force-pushed the add-redis-namespace-support branch from bea25a8 to 621f81f Compare November 14, 2018 05:50
Copy link
Owner

@mhenrixon mhenrixon left a comment

Choose a reason for hiding this comment

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

At first glance it looks good. I'll have to dig into this a little deeper before but I have no objections against this.

@mhenrixon mhenrixon merged commit 1c2db46 into mhenrixon:master Nov 19, 2018
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