-
Notifications
You must be signed in to change notification settings - Fork 192
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
flushall and flushdb vs namespaces #56
Comments
Yeah. This will cause lots of havok in the Resque tests.... |
👍 |
@steveklabnik definitely in a major version release if at all. The trouble is that the documentation claims that this wrapper "Namespaces all Redis calls", and yet it doesn't. Same for #34. The actual behaviour is very surprising in a very destructive way, so either that needs to stop happening or the documentation needs to be updated to something like "Namespaces most Redis calls that we know and care about, but lets the rest pass through unchanged" 😄. |
Does this mean that there is no way to flush a namespace? |
@plukevdh yes, that is correct. |
We are doing it currently like 👍 for |
@yaauie thanks for the suggestion. We have parallel tests that are isolated by the |
Thanks @dmitry. I believe you also have to wrap that call, since if redis.keys.any?
redis.del(redis.keys)
end |
@Fryie yes, that's right. To prevent from 2 calls, you have to use: if (keys = redis.keys) && !keys.empty?
redis.del(keys)
end |
Would there be any value in adding a new method that just deletes the namespaced keys? I could submit a PR if there is. |
So seems like this issue can be closed, because using them already produces a warning and will raise in 2.0 - redis-namespace/lib/redis/namespace.rb Lines 332 to 347 in f2f6016
Makes sense to me. |
* Vider Redis entre chaque spec * Use redis-namespace gem to handle parallel_tests * Define namespace in all envs to easily find app writes * See resque/redis-namespace#56 * Use a Redis set instead of a list https://redis.io/docs/data-types/sets/ Could not use command LPOS right now because redis-namespace does not support it. Besides, using a set is appropriate here. * Clarify key name * Add comment for new gem
Since these are especially destructive (beyond the scope of the namespace) and rather surprising to anyone who would think that namespacing provides segregation, perhaps
#flushall
and#flushdb
should be blocked in a future version, requiring the user to useRedisNamespace#redis
directly.The text was updated successfully, but these errors were encountered: