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 77d83db commit b905c15
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 10 deletions.
6 changes: 0 additions & 6 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 @@ -211,12 +208,9 @@ protected function mergeChannels(array $metrics): array
*/
protected function listenForMetrics(string $key): Deferred
{
dump('Listenting on '.$key);

$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
3 changes: 0 additions & 3 deletions src/Servers/Reverb/Publishing/RedisPubSubProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,13 @@ public function subscribe(): void
*/
public function on(string $event, callable $callback): void
{
dump('Listening from provider...');
$this->subscribingClient->on('message', function (string $channel, string $payload) use ($event, $callback) {
dump($payload);
$payload = json_decode($payload, associative: true, flags: JSON_THROW_ON_ERROR);

if (($payload['type'] ?? null) === $event) {
$callback($payload);
}
});
dump('Listening from provider...done');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
});

it('can gather data for a single channel', function () {
dump('Testing Redis');
$this->usingRedis();

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

0 comments on commit b905c15

Please sign in to comment.