Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions app/Listeners/DataIntegrationSubscriber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace App\Listeners;

use App\Events\SpeedtestCompleted;
use App\Events\SpeedtestFailed;
use App\Jobs\Influxdb\v2\WriteResult;
use App\Settings\DataIntegrationSettings;
use Illuminate\Events\Dispatcher;

class DataIntegrationSubscriber
{
/**
* Create the event listener.
*/
public function __construct(
public DataIntegrationSettings $settings,
) {}

/**
* Handle the event.
*/
public function handle(object $event): void
{
if ($this->settings->influxdb_v2_enabled) {
WriteResult::dispatch($event->result);
}
}

/**
* Register the listeners for the subscriber.
*
* @return array<string, string>
*/
public function subscribe(Dispatcher $events): array
{
return [
SpeedtestCompleted::class => 'handleSpeedtestCompleted',
SpeedtestFailed::class => 'handleSpeedtestFailed',
];
}
}
52 changes: 0 additions & 52 deletions app/Listeners/SpeedtestEventSubscriber.php

This file was deleted.