Skip to content

Commit 2e41c06

Browse files
Tweak cached results to ensure no false failures
1 parent ca37dee commit 2e41c06

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/HealthySqlDump.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,17 @@ public function checkHealth(BackupDestination $backupDestination)
4343
return;
4444
}
4545

46-
Cache::put($key, false, now()->addWeek());
46+
try {
47+
Cache::put($key, true, now()->addHour()); // Ensure we don't start multiple checks simultaneously
4748

48-
$this->performCheck($backupDestination, $newestBackup);
49+
$this->performCheck($backupDestination, $newestBackup);
4950

50-
Cache::put($key, true, now()->addWeek());
51+
Cache::put($key, true, now()->addWeek());
52+
} catch (\Exception $exception) {
53+
Cache::put($key, false, now()->addWeek());
54+
55+
throw $exception;
56+
}
5157
}
5258

5359
/**

0 commit comments

Comments
 (0)