restTemplate = new RestTemplateBuilder()
.setConnectTimeout(Duration.ofMillis(CONNECT_TIMEOUT))
.setReadTimeout(Duration.ofMillis(READ_TIMEOUT))
.build();
...
restTemplate.postForEntity(searchUrl, request, String.class);
Hi Nibrass,
1) Standard java11
app.yaml:
# [START runtime] runtime: java11 instance_class: F1 automatic_scaling: min_instances: 0 min_idle_instances: 0 max_instances: 2 entrypoint: java -noverify -jar app.jar inbound_services: - warmup env_variables: JAVA_TOOL_OPTIONS: "-XX:MaxRAM=256 -Xmx32m" # [END runtime]
I also wonder why I suddenly need the entrypoint. I didn't have to specify one with the other app(s), I think.
2) Pretty much what's above:
// request headers final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); headers.set("Referer", REFERER); headers.set("User-Agent", uaString); headers.setAccept(Collections.singletonList(MediaType.ALL)); // values final MultiValueMap<String, String> values = new LinkedMultiValueMap<>(); values.add("suchart", "detail"); // ... and some others final HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(values, headers); if (restTemplate == null)
restTemplate = new RestTemplateBuilder() .setConnectTimeout(Duration.ofMillis(CONNECT_TIMEOUT)) .setReadTimeout(Duration.ofMillis(READ_TIMEOUT)) .build();
return restTemplate.postForEntity(searchUrl, request, String.class);
3) Yupp. Here's the app.yaml of another app:
# [START runtime] runtime: java11 instance_class: F2 automatic_scaling: min_instances: 1 min_idle_instances: 1 max_instances: 8 #entrypoint: java -noverify -jar -0.0.1-SNAPSHOT.jar inbound_services: - warmup env_variables: JAVA_TOOL_OPTIONS: "-XX:MaxRAM=512m -Xmx64m" # [END runtime]
No entrypoint specified here. This app does not use the same resttemplate but at least org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate without issues.
Hope this helps. If you need the project ID or anything else just let me know.
Hi,
I have created a private issue on Issue Tracker to better investigate this issue as we will need access to your project to check the logs and use other internal tools to understand which might be the cause for these timeouts.
You should be able to access the private issue by using the same email address you used to create this discussion.
Further interactions will be done on: https://issuetracker.google.com/153078097