mirror of
https://github.com/joomla-extensions/patchtester.git
synced 2025-03-19 23:42:21 +00:00
Finish updating rate limit checks
This commit is contained in:
parent
4a555d1b68
commit
003b9c5791
@ -126,10 +126,16 @@ class PullModel extends \JModelBase
|
|||||||
{
|
{
|
||||||
// Get the Github object
|
// Get the Github object
|
||||||
$github = Helper::initializeGithub();
|
$github = Helper::initializeGithub();
|
||||||
|
$rate = $github->authorization->getRateLimit();
|
||||||
|
|
||||||
// Only act if there are API hits remaining
|
// If over the API limit, we can't build this list
|
||||||
if ($github->authorization->getRateLimit()->rate->remaining > 0)
|
if ($rate->resources->core->remaining == 0)
|
||||||
{
|
{
|
||||||
|
throw new \RuntimeException(
|
||||||
|
\JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', \JFactory::getDate($rate->resources->core->reset))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$pull = $github->pulls->get($this->getState()->get('github_user'), $this->getState()->get('github_repo'), $id);
|
$pull = $github->pulls->get($this->getState()->get('github_user'), $this->getState()->get('github_repo'), $id);
|
||||||
|
|
||||||
if (is_null($pull->head->repo))
|
if (is_null($pull->head->repo))
|
||||||
@ -238,11 +244,6 @@ class PullModel extends \JModelBase
|
|||||||
{
|
{
|
||||||
throw new \RuntimeException($table->getError());
|
throw new \RuntimeException($table->getError());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_API_LIMIT_ACTION', \JFactory::getDate($this->rate->reset)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -308,11 +308,14 @@ class PullsModel extends \JModelDatabase
|
|||||||
{
|
{
|
||||||
// Get the Github object
|
// Get the Github object
|
||||||
$github = Helper::initializeGithub();
|
$github = Helper::initializeGithub();
|
||||||
|
$rate = $github->authorization->getRateLimit();
|
||||||
|
|
||||||
// If over the API limit, we can't build this list
|
// If over the API limit, we can't build this list
|
||||||
if ($github->authorization->getRateLimit()->resources->core->remaining == 0)
|
if ($rate->resources->core->remaining == 0)
|
||||||
{
|
{
|
||||||
throw new \RuntimeException(\JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', \JFactory::getDate($this->rate->reset)));
|
throw new \RuntimeException(
|
||||||
|
\JText::sprintf('COM_PATCHTESTER_API_LIMIT_LIST', \JFactory::getDate($rate->resources->core->reset))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanity check, ensure there aren't any applied patches
|
// Sanity check, ensure there aren't any applied patches
|
||||||
|
Loading…
x
Reference in New Issue
Block a user