问题描述
我浏览了 Google Cloud API Gateway docs 并搜索了 the public issue tracker,但一直没有找到提及它的任何方式。
最接近的是 4 个月前的 this google groups thread,这表明它可能是 60 秒,但我无法确认这一点或确定它是否已过时。
TL;博士
我正在寻找 AWS API Gateway 的替代方案(它有一个固定的 30 秒超时),所以我想弄清楚 GCP API Gateway 是否可以作为这个特定点的替代方案。
解决方法
是的,GCP API 网关确实支持自定义超时长度。在您的开放 api 规范中,在“x-google-backend:”下方,插入“deadline: z”,其中 z 是超时前的秒数。
示例:
x-google-backend:
address: [this-is-your-address]
deadline: 60.0
以上将给出 60 秒的截止时间。