From ded3632dca7fd66618d5b712b4a0c6c1c77ecb3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Pedro=20Lopes?= Date: Tue, 19 Sep 2023 19:42:19 -0300 Subject: [PATCH] fix(clear-metrics): fixing the function name and when keys is null (#1319) --- src/Console/ClearMetricsCommand.php | 2 +- src/Repositories/RedisMetricsRepository.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Console/ClearMetricsCommand.php b/src/Console/ClearMetricsCommand.php index 45057de7..799c4c3b 100644 --- a/src/Console/ClearMetricsCommand.php +++ b/src/Console/ClearMetricsCommand.php @@ -29,7 +29,7 @@ class ClearMetricsCommand extends Command */ public function handle(MetricsRepository $metrics) { - $metrics->reset(); + $metrics->clear(); $this->info('Metrics cleared successfully.'); } diff --git a/src/Repositories/RedisMetricsRepository.php b/src/Repositories/RedisMetricsRepository.php index 486ef276..ba0c635e 100644 --- a/src/Repositories/RedisMetricsRepository.php +++ b/src/Repositories/RedisMetricsRepository.php @@ -393,7 +393,7 @@ public function clear() $cursor, ['match' => config('horizon.prefix').$pattern] ); - foreach ($keys as $key) { + foreach ($keys ?? [] as $key) { $this->forget(Str::after($key, config('horizon.prefix'))); } } while ($cursor > 0);