Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
joedixon committed May 8, 2024
1 parent 9ac51d3 commit 7194974
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Protocols/Pusher/MetricsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,15 @@ protected function gatherMetricsFromSubscribers(Application $application, string
*/
protected function requestMetricsFromSubscribers(Application $application, string $key, string $type, ?array $options): void
{
dump('Requesting metrics from subscribers using '.$key);

$this->pubSubProvider->publish([
'type' => 'metrics',
'key' => $key,
'application' => serialize($application),
'payload' => ['type' => $type, 'options' => $options],
])->then(function ($total) {
dump('Total subscribers: '.$total);
$this->subscribers = $total;
});
}
Expand Down Expand Up @@ -211,6 +214,8 @@ protected function listenForMetrics(string $key): Deferred
$deferred = new Deferred;

$this->pubSubProvider->on('metrics-retrieved', function ($payload) use ($key, $deferred) {
dump('Metrics received for '.$key, $payload);

if ($payload['key'] !== $key) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

$response = await($this->signedRequest('channels/test-channel-one?info=user_count,subscription_count,cache'));

dump("Time: %f\n", microtime(true) - $start);
dump(microtime(true) - $start);
expect($response->getStatusCode())->toBe(200);
expect($response->getBody()->getContents())->toBe('{"occupied":true,"subscription_count":2}');
});
Expand Down

0 comments on commit 7194974

Please sign in to comment.