Increase wait time when fetching project updated timestamps, and improve error messages

This commit is contained in:
Alex Cabal 2025-01-25 11:29:18 -06:00
parent 2aaa1e301f
commit 221daaacac
2 changed files with 5 additions and 5 deletions

View file

@ -554,11 +554,11 @@ final class Project{
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if(!is_string($response)){ if(!is_string($response)){
throw new Exceptions\AppException('Response from <' . $url . '> was not a string: ' . $response); throw new Exceptions\AppException('Server did not respond with a string: ' . $response);
} }
if($httpCode != Enums\HttpCode::Ok->value){ if($httpCode != Enums\HttpCode::Ok->value){
throw new Exception('HTTP code ' . $httpCode . ' received for URL <' . $url . '>.'); throw new Exception('Server responded with HTTP ' . $httpCode . '.');
} }
/** @var array<stdClass> $commits */ /** @var array<stdClass> $commits */
@ -590,11 +590,11 @@ final class Project{
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if(!is_string($response)){ if(!is_string($response)){
throw new Exceptions\AppException('Response from <' . $this->DiscussionUrl . '> was not a string: ' . $response); throw new Exceptions\AppException('Server did not respond with a string: ' . $response);
} }
if($httpCode != Enums\HttpCode::Ok->value){ if($httpCode != Enums\HttpCode::Ok->value){
throw new Exception('HTTP code ' . $httpCode . ' received for URL <' . $this->DiscussionUrl . '>.'); throw new Exception('Server responded with HTTP ' . $httpCode . '.');
} }
$matchCount = preg_match_all('/<span class="[^"]+?">([a-z]{3} [\d]{1,2}, [\d]{4}, [\d]{1,2}:[\d]{1,2}:[\d]{1,2}(?:AM|PM))/iu', $response, $matches); $matchCount = preg_match_all('/<span class="[^"]+?">([a-z]{3} [\d]{1,2}, [\d]{4}, [\d]{1,2}:[\d]{1,2}:[\d]{1,2}(?:AM|PM))/iu', $response, $matches);

View file

@ -89,5 +89,5 @@ foreach($projects as $project){
$project->Save(); $project->Save();
sleep(1); sleep(5);
} }