Skip to content

Commit

Permalink
[Bug] Don't use factory to test influxdb connection (#1892)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexjustesen authored Dec 5, 2024
1 parent 9d4dd81 commit 4ad2cbb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/Jobs/Influxdb/v2/TestConnectionJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

namespace App\Jobs\Influxdb\v2;

use App\Actions\Influxdb\v2\BuildPointData;
use App\Actions\Influxdb\v2\CreateClient;
use App\Models\Result;
use App\Models\User;
use Filament\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Support\Facades\Log;
use InfluxDB2\ApiException;
use InfluxDB2\Point;

class TestConnectionJob implements ShouldQueue
{
Expand All @@ -28,13 +27,16 @@ public function __construct(
*/
public function handle(): void
{
$result = Result::factory()->make();

$client = CreateClient::run();

$writeApi = $client->createWriteApi();

$point = BuildPointData::run($result);
$point = Point::measurement('speedtest')
->addTag('service', 'faker')
->addField('download', (int) 420)
->addField('upload', (int) 69)
->addField('ping', (float) 4.321)
->time(time());

try {
$writeApi->write($point);
Expand Down

0 comments on commit 4ad2cbb

Please sign in to comment.