Skip to content

[13.x] Support Delay attribute when using Bus::batch & bulk#60766

Draft
jackbayliss wants to merge 5 commits into
laravel:13.xfrom
jackbayliss:13.x-support-delay-attr-for-bus-batch-and-bulk
Draft

[13.x] Support Delay attribute when using Bus::batch & bulk#60766
jackbayliss wants to merge 5 commits into
laravel:13.xfrom
jackbayliss:13.x-support-delay-attr-for-bus-batch-and-bulk

Conversation

@jackbayliss

@jackbayliss jackbayliss commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Noticed this earlier via this, jobs pushed via Bus::batch() and Bus::bulk already respect $delay as a property, but, they ignore the Delay attribute.

This PR ensures the attribute is also covered. As I would expect the same behavior.

The SQS driver was already doing a is_object check, so I've replicated elsewhere.

This mean each Queue class checks the attribute / param now basically.

This means it fixes the below:

Code example
    dispatch(new DelayParamJob); // delayed 
    Bus::batch([new DelayParamJob])->dispatch(); // delayed 
    Queue::bulk([new DelayParamJob]); // delayed 
    
    dispatch(new DelayAttrJob); // delayed 
    Bus::batch([new DelayAttrJob])->dispatch(); // not delayed
    Queue::bulk([new DelayAttrJob]); // not delayed
    
    
    
class DelayPropertyJob implements ShouldQueue
{
    use Batchable, Queueable;

    public function __construct()
    {
        $this->delay = 60;
    }
}

#[Delay(60)]
class DelayAttributeJob implements ShouldQueue
{
    use Batchable, Queueable;
}

This isn't officially documented, but feels odd to support only the param and not the attr?

This also ensures there's no fifo etc issues, as the drivers are already responsible for this 🫡

Open to your feedback, maybe this sux? thanks!

@github-actions

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@jackbayliss jackbayliss changed the title [13.x] Support Delay attribute when using Bus::batch & bulk [13.x] Support Delay attribute when using Bus::batch & bulk Jul 13, 2026
@jackbayliss
jackbayliss force-pushed the 13.x-support-delay-attr-for-bus-batch-and-bulk branch from 2c7c4d9 to f21f71d Compare July 14, 2026 00:06
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

Successfully merging this pull request may close these issues.

1 participant