diff --git a/config/horizon.php b/config/horizon.php index 0e36957b..f17efe4f 100644 --- a/config/horizon.php +++ b/config/horizon.php @@ -113,8 +113,9 @@ |-------------------------------------------------------------------------- | | Here you can configure how many snapshots should be kept to display in - | the metrics graph. This will get used in combination with Horizon's - | `horizon:snapshot` schedule to define how long to retain metrics. + | the metrics graph and how often they can be stored. + | This will get used in combination with Horizon's `horizon:snapshot` + | schedule to define how long to retain metrics. | */ @@ -123,6 +124,7 @@ 'job' => 24, 'queue' => 24, ], + 'snapshot_lock' => 300, ], /* diff --git a/src/Console/SnapshotCommand.php b/src/Console/SnapshotCommand.php index 72c642b6..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', 300)) { + if ($lock->get('metrics:snapshot', config('horizon.metrics.snapshot_lock', 300) - 30)) { $metrics->snapshot(); $this->info('Metrics snapshot stored successfully.');