Our write request rate barely exceeds 1 request per 100s, yet we started getting this 429 error at every request for this method since this morning. Our write request rate is 3 requests / 100s, during 8am - 5am and never exceeds that (9 requests every 5 minutes or so). Totaling around 50k requests for the whole month. So nowhere near any of Google's default quota limits. What are we missing?
The response body is
"error": {
"code": 429,
"message": "Resource has been exhausted (e.g. check quota).",
"errors": [
{
"message": "Resource has been exhausted (e.g. check quota).",
"domain": "global",
"reason": "rateLimitExceeded"
}
],
"status": "RESOURCE_EXHAUSTED"
}
Relevant part of the source code is (part of) a PHP class representing a console command:
class UpdatePresentations extends CommandUsingDb
{
/** @var Google_Service_Slides */
private $slides;
/** @var Google_Service_Slides_Request[] */
private $requests = [];
private function updateChart(Google_Service_Slides_Presentation $presentation, OutputProvider $outputProvider, Site $site)
{
// refresh charts in slides
foreach ($presentation->getSlides() as $index => $slide) {
foreach ($slide->getPageElements() as $element) {
/** @var Google_Service_Slides_PageElement $element */
$chart = $element->getSheetsChart();
if ($chart instanceof Google_Service_Slides_SheetsChart) {
$this->requests[] = new Google_Service_Slides_Request([
'refreshSheetsChart' => [
'objectId' => $element->getObjectId(),
],
]);
}
}
}
}
private function flush(Google_Service_Slides_Presentation $presentation)
{
if (empty($this->requests)) return;
$batchUpdateRequest = new Google_Service_Slides_BatchUpdatePresentationRequest();
$batchUpdateRequest->setRequests($this->requests);
$this->slides->presentations->batchUpdate($presentation->presentationId, $batchUpdateRequest);
}
}