class NoBatchedUniqueJobRule implements Rule

A job implementing ShouldBeUnique must not be dispatched through the bulk or batch entry points: Bus::batch([...]), Bus::bulk([...]), Queue::bulk([...]), or a batch's add().

Only an individual dispatch acquires the unique lock. Bulk dispatch and batches push the jobs through the queue's bulk() without it, so duplicates are queued and ShouldBeUnique silently does nothing. A later job of a chain within a batch is dispatched individually when the chain advances, but a duplicate is then skipped after the batch has counted it, so the batch never finishes.

Dispatch unique jobs individually instead.

Traits

Constants

private FACADE_METHODS

The bulk and batch methods of each facade, keyed by its alias.

private RECEIVER_METHODS

The bulk and batch methods each receiver type provides.

Unlike upstream, which checks only the facades, the documented $this->batch()->add() and bulk calls on dispatcher and queue instances bypass the lock too.

Methods

string
getNodeType()

Get the node type the rule inspects.

array
processNode(Node $node, Scope $scope)

Report unique jobs dispatched through a bulk or batch entry point.

Details

at line 77
string getNodeType()

Get the node type the rule inspects.

Return Value

string

at line 88
array processNode(Node $node, Scope $scope)

Report unique jobs dispatched through a bulk or batch entry point.

Parameters

Node $node
Scope $scope

Return Value

array