From 89410812a8dd81790b6c875da8d6db36df306797 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 29 Jan 2025 17:31:12 +0100 Subject: [PATCH] formatting --- src/Jobs/ProcessPendingUpdates.php | 4 +++- src/Telescope.php | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Jobs/ProcessPendingUpdates.php b/src/Jobs/ProcessPendingUpdates.php index 7d65e0462..55a5b9924 100644 --- a/src/Jobs/ProcessPendingUpdates.php +++ b/src/Jobs/ProcessPendingUpdates.php @@ -50,6 +50,8 @@ public function handle(EntriesRepository $repository) { $this->attempt++; + $delay = config('telescope.queue.delay'); + $repository->update($this->pendingUpdates)->whenNotEmpty( fn ($pendingUpdates) => static::dispatchIf( $this->attempt < 3, $pendingUpdates, $this->attempt @@ -57,7 +59,7 @@ public function handle(EntriesRepository $repository) config('telescope.queue.connection') )->onQueue( config('telescope.queue.queue') - )->delay(config('telescope.queue.delay') ? now()->addSeconds(config('telescope.queue.delay')) : null), + )->delay(is_numeric($delay) && $delay > 0 ? now()->addSeconds($delay) : null), ); } } diff --git a/src/Telescope.php b/src/Telescope.php index c0a5e7ac8..7c555822c 100644 --- a/src/Telescope.php +++ b/src/Telescope.php @@ -663,13 +663,15 @@ public static function store(EntriesRepository $storage) $updateResult = $storage->update(static::collectUpdates($batchId)) ?: Collection::make(); if (! isset($_ENV['VAPOR_SSM_PATH'])) { + $delay = config('telescope.queue.delay'); + $updateResult->whenNotEmpty(fn ($pendingUpdates) => rescue(fn () => ProcessPendingUpdates::dispatch( $pendingUpdates, )->onConnection( config('telescope.queue.connection') )->onQueue( config('telescope.queue.queue') - )->delay(config('telescope.queue.delay') ? now()->addSeconds(config('telescope.queue.delay')) : null))); + )->delay(is_numeric($delay) && $delay > 0 ? now()->addSeconds($delay) : null))); } if ($storage instanceof TerminableRepository) {