Skip to content

Commit

Permalink
Merge pull request #292 from RobertoRomolini/master
Browse files Browse the repository at this point in the history
Add total time spent in sleep during multiple requests
  • Loading branch information
tareqtms authored May 29, 2023
2 parents 9e885b7 + 99a0b13 commit eb26e68
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/CurlRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ class CurlRequest
*/
public static $lastHttpResponseHeaders = array();

/**
* Total time spent in sleep during multiple requests (in seconds)
*
* @var int
*/
public static $totalRetrySleepTime = 0;

/**
* Curl additional configuration
*
Expand Down Expand Up @@ -196,6 +203,7 @@ protected static function processRequest($ch)
break;
}

self::$totalRetrySleepTime += (float)$retryAfter;
sleep((float)$retryAfter);
}

Expand All @@ -210,5 +218,4 @@ protected static function processRequest($ch)

return $response->getBody();
}

}

0 comments on commit eb26e68

Please sign in to comment.