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 0d4d7f8 commit 806b34e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 8 deletions.
5 changes: 0 additions & 5 deletions src/Protocols/Pusher/MetricsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,12 @@ 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 @@ -214,8 +211,6 @@ protected function listenForMetrics(string $key): Deferred
$deferred = new Deferred;

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

if ($payload['key'] !== $key) {
return;
}
Expand Down
1 change: 0 additions & 1 deletion src/Servers/Reverb/Publishing/RedisPubSubProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public function subscribe(): void

$this->subscribingClient->subscribe($this->channel)
->then(function () {
dump('Subscribed to pubsub');
$this->subscribingClient->on('message', function (string $channel, string $payload) {
$this->messageHandler->handle($payload);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,13 @@
});

it('can gather data for a single channel', function () {
$start = microtime(true);
$this->usingRedis();

subscribe('test-channel-one');
subscribe('test-channel-one');

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

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 806b34e

Please sign in to comment.