From 3926a8ddacc46fa1b19828a5a0638848df93f876 Mon Sep 17 00:00:00 2001 From: Jonas De Smet Date: Thu, 26 Nov 2020 22:38:00 +0100 Subject: [PATCH] Fix for edge cases when locks aren't released Because the scheduler had the same amount of time, you can have a race condition that lock isn't over yet. --- src/Console/SnapshotCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/SnapshotCommand.php b/src/Console/SnapshotCommand.php index 50b463429..3bca1f07c 100644 --- a/src/Console/SnapshotCommand.php +++ b/src/Console/SnapshotCommand.php @@ -31,7 +31,7 @@ class SnapshotCommand extends Command */ public function handle(Lock $lock, MetricsRepository $metrics) { - if ($lock->get('metrics:snapshot', config('horizon.metrics.snapshot_lock', 300))) { + if ($lock->get('metrics:snapshot', config('horizon.metrics.snapshot_lock', 300)-30)) { $metrics->snapshot(); $this->info('Metrics snapshot stored successfully.');