From 70286c3f292f918d55fd9e00f353ff4b5009335f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Br=C3=A4utigam?= Date: Fri, 31 Mar 2023 21:48:34 +0200 Subject: [PATCH] Add timeout option to Pirsch configurationThis commit adds a timeout option to the Pirsch configuration, allowing for a customizable timeout for API requests --- config/pirsch.php | 2 ++ src/Pirsch.php | 7 +------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/config/pirsch.php b/config/pirsch.php index 37687fa..5fb0189 100644 --- a/config/pirsch.php +++ b/config/pirsch.php @@ -4,4 +4,6 @@ 'token' => env('PIRSCH_TOKEN'), + 'timeout' => env('PIRSCH_TIMEOUT', 250), + ]; diff --git a/src/Pirsch.php b/src/Pirsch.php index a9be9ca..330b62f 100755 --- a/src/Pirsch.php +++ b/src/Pirsch.php @@ -18,12 +18,7 @@ public static function track( try { Http::withToken(config('pirsch.token')) - ->connectTimeout(0.5) - ->retry( - times: 3, - sleepMilliseconds: 100, - throw: false, - ) + ->timeout(config('pirsch.timeout')) ->post( url: 'https://api.pirsch.io/api/v1/'.($name === null ? 'hit' : 'event'), data: [