Process task by batch
We often put in the queue a method call with a list of records. But often there is no strict need that all the records are being processed in the same transaction nor at the same time.
We can have performance issue when the list of records is very large (and if the method take locks on table or many records) and it takes time to process all of them. So often the system will be more reactive if if we process small batch of records instead of all of them.
So I propose to add a new contextual parameters to __queue__
calls which allow the queue to create many tasks (batches) for one call. The parameter will allow to just activate the feature (with a default batch size) or define the size for the batch. Of course the division will only happen if there are workers otherwise there is no benefit.