diff --git a/src/Mixins/EloquentBuilderMixin.php b/src/Mixins/EloquentBuilderMixin.php index f79d40c..b314e2d 100644 --- a/src/Mixins/EloquentBuilderMixin.php +++ b/src/Mixins/EloquentBuilderMixin.php @@ -285,10 +285,14 @@ public function chunkWithQueue(): callable $builder = new SerializableBuilder($query); + $delayNumber = 1; + for ($chunkNumber = $minChunkNumber; $chunkNumber <= $maxChunkNumber; $chunkNumber++) { dispatch(new GenerateChunksJob($builder, $params, $chunkNumber)) ->onQueue($settings->queueOptions->pieceQueue) - ->delay($settings->queueOptions->delay ? $settings->queueOptions->delay * ($chunkNumber - 1) : null); + ->delay($settings->queueOptions->delay ? $settings->queueOptions->delay * ($delayNumber - 1) : null); + + $delayNumber++; } return true;