Recently been observing this in our Laravel project that Pusher is getting clogged up with messages upto the limit. This is abnormal for usage of peak concurrent - 16 and 4 million messages a day.
Going through the Pusher dashboard, below is the extent of the damage being done.
There is a specific pattern of usage. When I turn off the supervisord worker, the graph stops and when I start the worker again, it comes back up in a predictable pattern shown in the graph below.
Below is a sample message I got when running redis-cli monitor
.
As you can see above, the index [attempts] is 69507. Does that mean that this event has been broadasted 69507 times ? Why would an event be broadcasted so many times ? When does an event stop being broadcasted ? Am I doing something wrong ?
Here is the code for the AgendaParticipantUpdated
event. Would be great if there is something fundamentally wrong in the way the event has been implemented.
<?php
namespace App\Events;
use App\AgendaParticipant;
use App\Agenda;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
class AgendaParticipantUpdated implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/** @var agendaParticipant */
public $agendaParticipant;
/**
* Create a new event instance.
*
* @param AgendaParticipant $agendaParticipant
*/
public function __construct(AgendaParticipant $agendaParticipant)
{
$this->agendaParticipant = $agendaParticipant;
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel("meetings.{$this->agendaParticipant->agenda->meeting->id}");
}
/**
* Get the data to broadcast.
*
* @return array
*/
public function broadcastWith()
{
$agenda = Agenda::where('id', $this->agendaParticipant->agenda->id)->first();
$agenda->load(['participants' => function ($query) {
$query->orderBy('order')->orderBy('id');
}, 'participants.member.user']);
return [
'agendaParticipant' => $this->agendaParticipant,
'agenda' => $agenda,
];
}
}
Would appreciate any help on this since it is interfering with our daily operations.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire