resque-delayed icon indicating copy to clipboard operation
resque-delayed copied to clipboard

redis-namespace support

Open wulffeld opened this issue 13 years ago • 6 comments

Would be nice. I run a couple apps using that in order for queues not to conflict.

wulffeld avatar Jan 11 '12 20:01 wulffeld

Good point. I'll look into it.

elucid avatar Jan 11 '12 21:01 elucid

Okay. I think the correct thing to do is to piggyback on Resque.redis.namespace and use the same namespace for resque-delayed's queue. I assume that you are using resque namespaces if you are running multiple apps on the same Redis instance.

The fix for this is trivial, but an upgrade to support namespaces will orphan existing queues if users aren't aware of it. I was going to just have resque-delayed issue a warning if it found a Resque::Delayed:internal key (which is the internal name of the queue) in the connected Redis instance but maybe that's not strong enough. Is it unreasonable to raise an exception advising users that they have to run the provided migrate task to rename their queue?

elucid avatar Jan 16 '12 05:01 elucid

I guess those people using resque-delayed right now are also not using redis-namespace so their queue name would remain the same "Resque::Delayed::internal"? If that's the case you don't really need a warning as I see it. If I'm wrong about that I don't think it's unreasonable to raise.

wulffeld avatar Jan 16 '12 05:01 wulffeld

Well, the queue name will be "Resque::Delayed::internal" for anyone using resque-delayed right now, even those who have a namespace set with resque. Also, you don't have to use redis-namespace explicitly in order to have a namespace with resque--if you use a hostname:port/namespace string in your resque config it will take the namespace from there. What are you using for namespacing?

elucid avatar Jan 16 '12 15:01 elucid

Ah I see.

I'm using redis-namespace.

wulffeld avatar Jan 16 '12 17:01 wulffeld

Yeah, resque will internally create a Redis::Namespace instance if you pass it a namespace via config or you can alternately pass in a Redis::Namespace instance directly that will get used instead.

elucid avatar Jan 16 '12 19:01 elucid