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

Doesn't play well with redis-namespace #196

Closed
blarralde opened this issue Oct 13, 2016 · 6 comments
Closed

Doesn't play well with redis-namespace #196

blarralde opened this issue Oct 13, 2016 · 6 comments

Comments

@blarralde
Copy link

blarralde commented Oct 13, 2016

I couldn't quite figure out where it happens in the code, but somehow namespaces are not added to the main hash key. Example of what I see in redis:

redis = Redis::Namespace.new("sidekiq", redis: REDIS)
redis.keys
=> ["sidekiq:processes", "sidekiq:stat:failed", "sidekiq:sidekiq:status:b635df490af7a6fc0441892f", "uniquejobs", "sidekiq:uniquejobs:4a3b0ea5cd32400c837ec73565aa178d"]
redis.hgetall "uniquejobs"
=> {"ac11feaaea4378ba6f1f7df0"=>"sidekiq:uniquejobs:4a3b0ea5cd32400c837ec73565aa178d"}
redis.get "sidekiq:uniquejobs:4a3b0ea5cd32400c837ec73565aa178d"
=> "ac11feaaea4378ba6f1f7df0"

So somehow the hash doesn't get namespaced, but the unique job key inside of it does.

My guess would be that:

@dpetersen
Copy link

I don't know a lot about this gem, but I'm trying to sort out a problem with an app that uses it and I was trying to figure out if it was namespace safe. It appears not. As far as an explanation, I haven't had time to test this out, but the gem uses Lua scripts that are evaluated and run on your redis server. I'm guessing that it circumvents the way redis-namespace works. I think you can configure a unique_prefix (as seen here and used here), but it still doesn't appear to namespace the key, it just adds something to the way jobs get hashed so that different apps that work on a shared redis won't collide.

@mhenrixon
Copy link
Owner

Support for namespace has been dropped.

@aCandidMind
Copy link

Wouldn't it make sense to drop that code then?
https://github.com/mhenrixon/sidekiq-unique-jobs/search?q=namespace

@mhenrixon
Copy link
Owner

👍 @aCandidMind

@mengqing
Copy link

mengqing commented Sep 8, 2018

Any reason why support for namespace has been dropped? We run our sidekiq server on a namespace and currently this doesn't work (eg: when specifying replace when on conflict, the existing job doesn't get replaced)

@mhenrixon
Copy link
Owner

Partly because doing so means supporting a bad way of doing the Redis thing, partly because I am lazy.

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

No branches or pull requests

5 participants