Skip to content

Commit

Permalink
warning when api comes back
Browse files Browse the repository at this point in the history
  • Loading branch information
tomahock committed Jul 8, 2024
1 parent 79a0d4c commit 52271e7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/Jobs/ProcessANPCAllDataV2.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,20 @@ public function handle()

$last = end($x);
$now = Carbon::now();
$then = Carbon::parse($last['time']);
$diff = $then->diffInMinutes($now);

if($last['hash'] !== $currentHash){
$x[] = [
'hash' => $currentHash,
'time' => $now,
'notify' => false
];

if($last['notify']){
DiscordTool::postError('Voltou a API depois de ' . $diff . ' minutos sem atualizar');
}
} else {
$then = Carbon::parse($last['time']);
$diff = $then->diffInMinutes($now);
if( $diff >= 10){
DiscordTool::postError('A API não atualiza ha 10 minutos');
$last['notify'] = true;
Expand Down

0 comments on commit 52271e7

Please sign in to comment.