Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

increase read timeout for larger discovery docs #192

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ InputStream postRequest(String url, String boundary, String content) throws IOEx
HttpRequestFactory requestFactory = new NetHttpTransport().createRequestFactory();
HttpRequest request = requestFactory.buildPostRequest(new GenericUrl(url),
ByteArrayContent.fromString("multipart/form-data; boundary=" + boundary, content));
request.setReadTimeout(60000); // 60 seconds is the max App Engine request time
request.setReadTimeout(600000); // Larger discovery documents require more than 20 sec to process
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is surprising. More than a minute seems like something has gone wrong and the request should time out. None of our docs should be nearly large enough to go over a minute.

Copy link
Author

@cmaan cmaan Mar 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's just a combination of a larger discovery doc and a smaller compute core. We gradually hit the limit once in a while, with increasing frequency as our discovery doc grew. We have 295 endpoints currently.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elharo We've since reduced our discovery doc, but still run 50 sec and hit the limit once in a while with the upstream version. Are there any internal things you'd need to check on why this takes so long? From our perspective, increasing the timeout should be fine. Anyway, in case increasing the timeout is not viable upstream, the comment 60 seconds is the max App Engine request time is not true anymore, the max App Engine request time is now 10 min.

HttpResponse response = request.execute();
if (response.getStatusCode() >= 300) {
throw new IOException("Client Generation failed at server side: " + response.getContent());
Expand Down