Closed NicklasT closed 5 years ago
Okay, so I have now realized that queues are being used for the Event Listeners.
Cog\Laravel\Love\Reactant\Listeners\IncrementAggregates Cog\Laravel\Love\Reactant\Listeners\DecrementAggregates
I did not have my queue driver properly set up so these jobs were never executed.
I believe the issue can be closed.
Hi, @NicklasT! Thank you for the feedback. We should highlight this in documentation.
You are right, those 2 listeners are waiting for ReactionHasBeenRemoved
or ReactionHasBeenAdded
events being fired and updates aggregates values in database.
If you have QUEUE_CONNECTION=sync
defined in .env
file - aggregates update will be done synchronously. To prevent long wait time and browser hanging connection just setup queue connection in your application and updates will be executed on background. This happens because both listeners implements Illuminate\Contracts\Queue\ShouldQueue
interface.
I've added Aggregation Queue to documentation.
@antonkomarev I also just got this error. In my opinion the error should be caught and a more descriptive error should be shown.. the Call to undefined method Cog\Laravel\Love\Reactant\ReactionTotal\Models\NullReactionTotal::update()
being caused by queues not being active is quite confusing
Also, it would be nice if the love:recount
command had an optional parameter so it can be executed on the sync
queue without having to change the queue settings in the .env file
My queue driver is set to redis
but I have many jobs which I can run on sync when executed manually from the command line by doing something like this:
public function __construct(QueueManager $queueManager)
{
$this->queueManager = $queueManager;
parent::__construct();
}
public function handle()
{
ini_set('max_execution_time', 9999);
ini_set('memory_limit', '2048M');
$this->queueManager->setDefaultDriver('sync');
...
@antonkomarev I just made sure that my queues are working now, I can see that Laravel Horizon is up and running, yet I am still getting the same error when I try to run love:recount
Is there something more I need to do in order to make this work with Horizon?
Actually now I'm trying with the QUEUE_CONNECTION=sync
and still getting the same error.. hrmm..
Hi, this is the first time I open an issue on GitHub, so forgive me if I am missing some conventions. First of all, thank you for this package.
When running "php artisan:love recount" in the command prompt, I get this error:
I also have an issue with reaction count in general, it seems the database tables for counters are empty, even when there are reactions.
I have some reactions as can been seen below. The reactions are added through for example
$reacterFacade->reactTo($likable, $likestatus);
and enter thelove_reactions
table as expected as seen below.But the counters/totals tables are still empty.
Something like
$reactantFacade->getReactionCounterOfType('Like')->getCount()
also returns 0.As far as I can tell I have set up my models as per the installation instructions and have an
App\User
as theReacterable
and anApp\Review
asReactable
.Any advise is much appreciated.