From 3ea21594a681fb921ade9de6b4f53308c277f32c Mon Sep 17 00:00:00 2001 From: adonis Date: Sat, 22 Aug 2026 14:42:28 +0330 Subject: [PATCH] fix all error --- app/Services/ZaarboxPriceService.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/Services/ZaarboxPriceService.php b/app/Services/ZaarboxPriceService.php index 3367d80..0dacc79 100644 --- a/app/Services/ZaarboxPriceService.php +++ b/app/Services/ZaarboxPriceService.php @@ -5,6 +5,7 @@ namespace App\Services; use App\Models\Product; use App\Models\Setting; use Carbon\Carbon; +use Illuminate\Http\Client\Response; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Http; @@ -796,7 +797,7 @@ class ZaarboxPriceService $responses = Http::pool(function ($pool) use ($now) { foreach (self::PERIODS as $key => $config) { $start = $now->copy()->subHours($config['hours']); - $pool->as($key)->withHeaders([ + $pool->as($key)->withoutVerifying()->timeout(12)->withHeaders([ 'Referer' => 'https://tablo.montest.ir/', 'User-Agent' => 'Mozilla/5.0', ])->get($this->historyUrl($start, $now)); @@ -809,11 +810,14 @@ class ZaarboxPriceService $response = $responses[$key] ?? null; $start = $now->copy()->subHours($config['hours']); - if (!$response || !$response->successful()) { - Log::warning('Zaarbox price history fetch failed', [ - 'period' => $key, - 'status' => $response?->status(), - ]); + if (!$response instanceof Response || !$response->successful()) { + $logContext = ['period' => $key]; + if ($response instanceof Response) { + $logContext['status'] = $response->status(); + } elseif ($response instanceof \Throwable) { + $logContext['message'] = $response->getMessage(); + } + Log::warning('Zaarbox price history fetch failed', $logContext); $prices[$key] = []; continue; }