From 9915097cae458de413f0207556ee56d2ad074ba4 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 50b46342..5db99336 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.');