Skip to content

Ability to push job into Redis Queue from inside a Redis Multi block #355

Open
@luqmansungkar

Description

@luqmansungkar

If I have code that look like this:

<?php

$redis = \Yii::$app->redis;
$redis->multi();
\Yii::$app->queue->push(new SomeJob());
\Yii::$app->queue->push(new SomeJob());
$redis->exec();

The job will be pushed with QUEUED as the id, and only the last job that will be run. That's because this line read from to use an incremented number as the job id.

I propose to use something that doesn't read from redis as the value for id, such as uniqid.

Also, can I know the reason why we used hset to store the job message and only push the job id to the list, instead of directly pushing the id along with the job message to list and not using hset?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions