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

Prefixes are not properly documented

Open Madeorsk opened this issue 5 years ago • 2 comments

Expected Behavior

I tried to use a prefix. So I defined it while running my workers, and then I tried to use the same prefix when enqueuing.

Current Behavior

But it did not work, because the $prefix argument of this function is not the same thing.

Possible Solution

Document Resque_Redis::prefix in this part https://github.com/resque/php-resque#custom-prefix

Suggestion

If these two prefixes are not the same thing, I suggest to rename one. In another library, what you call "prefix" is called "namespace".

Madeorsk avatar May 29 '20 13:05 Madeorsk

@Madeorsk how do prefixes work exactly? I'm trying to do exactly what you attempted with prefixes but my jobs are not being run. What is the correct way to implement?

lynndylanhurley avatar Feb 08 '21 18:02 lynndylanhurley

@lynndylanhurley As it is documented on the link pasted here, use PREFIX=my-app-name bin/resque to start a worker for a specific prefix.

To enqueue tasks for this prefix, you need to use Resque_Redis::prefix before enqueuing. Here is a sample code where PREFIX=foo.

\Resque_Redis::prefix("foo");

\Resque::enqueue("myjobs", Job::class, [
	"arg" => "hello world",
]);

Madeorsk avatar Feb 09 '21 11:02 Madeorsk