Skip to content

Commit

Permalink
Add timeout option to Pirsch configurationThis commit adds a timeout …
Browse files Browse the repository at this point in the history
…option to the Pirsch configuration, allowing for a customizable timeout for API requests
  • Loading branch information
xyNNN committed Mar 31, 2023
1 parent 16efb9a commit 70286c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 2 additions & 0 deletions config/pirsch.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

'token' => env('PIRSCH_TOKEN'),

'timeout' => env('PIRSCH_TIMEOUT', 250),

];
7 changes: 1 addition & 6 deletions src/Pirsch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down

0 comments on commit 70286c3

Please sign in to comment.