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

[5.4] Phpredis does not work with delayed redis queue #17828

Closed
lucasfecko opened this issue Feb 8, 2017 · 2 comments
Closed

[5.4] Phpredis does not work with delayed redis queue #17828

lucasfecko opened this issue Feb 8, 2017 · 2 comments

Comments

@lucasfecko
Copy link

  • Laravel Version: 5.4.10
  • PHP Version: 7.1.0

Description:

When trying to pass a delayed job to queue when the client is set as phpredis, exception Symfony\Component\Debug\Exception\FatalThrowableError
is thrown:

Type error: Argument 2 passed to Illuminate\Redis\Connections\PhpRedisConnection::zadd() must be of the type array, integer given,

This is because PhpRedisConnection accepts array as second parameter:

/**
     * Add one or more members to a sorted set or update its score if it already exists.
     *
     * @param  string  $key
     * @param  array  $membersAndScoresDictionary
     * @return int
     */
    public function zadd($key, array $membersAndScoresDictionary)
    {
        $arguments = [];

        foreach ($membersAndScoresDictionary as $member => $score) {
            $arguments[] = $score;
            $arguments[] = $member;
        }

        return $this->command('zadd', ...$arguments);
    }

But integer (timestamp) is passed in RedisQueue:

$this->getConnection()->zadd(
    $this->getQueue($queue).':delayed', $this->availableAt($delay), $payload
);

Steps To Reproduce:

  1. Set your client in database.php config file as phpredis
  2. try to add job as delayed:
$job = new ExampleJob($data);
$this->dispatch($job->onQueue('medium')->delay(15 * 60));
@themsaid
Copy link
Member

themsaid commented Feb 8, 2017

I've submitted a fix, thank you :)

#17831

@manfield
Copy link

manfield commented Aug 17, 2017

I've the same issue if I use predis and not phpredis as queue_driver.

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

3 participants