Aggregation Queue
ReactionCounter
& ReactionTotal
aggregates updates synchronously when you have QUEUE_CONNECTION=sync
defined in .env
file. On large databases this operations are expensive and could lead to long wait time and browser hanging connection.
There are 2 listeners which are responsible for aggregates updates:
Cog\Laravel\Love\Reactant\Listeners\IncrementAggregates
Cog\Laravel\Love\Reactant\Listeners\DecrementAggregates
They are waiting for ReactionHasBeenRemoved
or ReactionHasBeenAdded
events being dispatched and updates aggregates values in database.
Setup queue connection in your application and updates will be executed on background. This happens because those listeners implements Illuminate\Contracts\Queue\ShouldQueue
interface.
Updated almost 6 years ago