Skip to content

Commit

Permalink
fixes for DB Checks
Browse files Browse the repository at this point in the history
  • Loading branch information
turbo124 committed Jun 10, 2020
1 parent 97157e5 commit 11e8d8d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Jobs/Database/MySQL/DbStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Turbo124\Beacon\Collector;
use Turbo124\Beacon\Generator;
use Turbo124\Beacon\ExampleMetric\GenericGauge;
use Turbo124\Beacon\ExampleMetric\GenericMixedMetric;
use Turbo124\Beacon\Generator;
use Turbo124\Beacon\Jobs\Database\Traits\StatusVariables;

class DbStatus
Expand Down Expand Up @@ -42,9 +43,8 @@ public function __construct(string $connection, string $name, bool $force_send =
*/
public function handle()
{
$db_connection = config($this->connection);

config(['database.default' => $db_connection]);
config(['database.default' => $this->connection]);
$db_status = $this->checkDbConnection();

$metric = new GenericGauge();
Expand All @@ -55,8 +55,7 @@ public function handle()
$collector->create($metric);

if($this->force_send || !$db_status){ //if there is no DB connection, then we MUST fire immediately!!
$collector->fire();
$collector->alert();
$collector->send();
}
else
$collector->batch();
Expand Down

0 comments on commit 11e8d8d

Please sign in to comment.