setting the CURL time out on the google Ads Client

118 views
Skip to first unread message

roliver

unread,
Dec 16, 2022, 7:52:46 AM12/16/22
to Google Ads API and AdWords API Forum
Is it possible to set the CURLOPT_CONNECTTIMEOUT and CURLOPT_TIMEOUT after or during the creation of a google ads client.  See the example of how I am creating a client currently.

$oAuth2Credential = (new OAuth2TokenBuilder())->fromFile(self::API_INI_FILE)->build();

$googleAdsClient = (new GoogleAdsClientBuilder())
->fromFile(self::API_INI_FILE)
->withOAuth2Credential($oAuth2Credential)
->withLogger($logger)
->build();

There are no methods, at least I can't find any, that allows me to set these options like so
$googleAdsClient->setDefaultOption('CURLOPT_CONNECTTIMEOUT', 100);
$googleAdsClient->setDefaultOption('CURLOPT_TIMEOUT', 2000);

Can it be done in the google_ads_ini.php?  If so how?  Links docs would greatly be appreciated. 

Additional context:
I am using the batch service to create Geo Targeting mutation operations.  Every so often the batch resource reports back with a curl timeout error.  
===============================
         2331 mutate operations have been added.
         Next sequence token for adding next operations is 'd0a2ecc054e1998161242cad7507083b'.
         Batch job with resource name 'customers/[REDACTED]/batchJobs/12030701356' has been executed.
ERROR: cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://googleads.googleapis.com/v11/customers/[REDACTED]/operations/CipjdXN0b21lcnMvNzY4NTM4Njg3Mi9iYXRjaEpvYnMvMTIwMzA3MDEzNTYQCw==ERROR: cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://googleads.googleapis.com/v11/customers/[REDACTED]/operations/CipjdXN0b21lcnMvNzY4NTM4Njg3Mi9iYXRjaEpvYnMvMTIwMzA3MDEzNTYQCw==
=================================

the timeout always seems to occur during the polling for the batch to complete

Google Ads API Forum Advisor

unread,
Dec 16, 2022, 11:04:16 AM12/16/22
to roli...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

We only provide support related to the Google Ads API. For the PHP client library, with this,I recommend you to reach out to PHP client library owners by opening a new issue with their team via issue tracker, for further assistance.

Thanks,
Google Logo
Nirmita
Google Ads API Team
 


ref:_00D1U1174p._5004Q2h3nvf:ref
Reply all
Reply to author
Forward
0 new messages