超时
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
每项服务都附带该服务的 client.rb
文件中指定的默认超时和重试政策。例如,查看广告系列服务的 client.rb
,找到 self.configure
方法。
在您实例化服务后,可以替换其默认值。为此,请按照 set_custom_client_timeouts.rb
中的示例进行操作。
您可以根据需要设置超时,但时长超过两个小时的响应可能会导致 DEADLINE_EXCEEDED
错误。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-26。
[null,null,["最后更新时间 (UTC):2025-08-26。"],[[["\u003cp\u003eEach Google Ads API service has a default timeout and retry policy defined in its \u003ccode\u003eclient.rb\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eThese defaults can be overridden after service instantiation using the approach demonstrated in the \u003ccode\u003eset_custom_client_timeouts.rb\u003c/code\u003e example.\u003c/p\u003e\n"],["\u003cp\u003eWhile custom timeouts can be set to any duration, responses exceeding two hours might lead to a \u003ccode\u003eDEADLINE_EXCEEDED\u003c/code\u003e error.\u003c/p\u003e\n"]]],[],null,["# Timeouts\n\nEach service comes with a default timeout and retry policy specified in that\nservice's `client.rb` file. For an example, take a look at the campaign\nservice's\n[`client.rb`](https://github.com/googleads/google-ads-ruby/blob/main/lib/google/ads/google_ads/v21/services/campaign_service/client.rb)\nand find the `self.configure` method.\n\nThese defaults can be overridden on a service after you instantiate it. To do\nso, follow the example in\n[`set_custom_client_timeouts.rb`](https://github.com/googleads/google-ads-ruby/blob/main/examples/misc/set_custom_client_timeouts.rb).\n\nYou can set a timeout as large as you like, but responses that take over two\nhours might result in a\n[`DEADLINE_EXCEEDED`](/google-ads/api/reference/rpc/v21/InternalErrorEnum.InternalError) error."]]