From ed3da824c3ba89683f81c60844bfb4701e44939e Mon Sep 17 00:00:00 2001 From: Antoine Balliet Date: Thu, 5 Oct 2023 15:44:08 +0200 Subject: [PATCH 1/2] feaat: increase read timeout and setMaxContentLength to MAX_VALUE --- .../kestra/plugin/dbt/cloud/AbstractDbtCloud.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/kestra/plugin/dbt/cloud/AbstractDbtCloud.java b/src/main/java/io/kestra/plugin/dbt/cloud/AbstractDbtCloud.java index 47e30b5..0f19221 100644 --- a/src/main/java/io/kestra/plugin/dbt/cloud/AbstractDbtCloud.java +++ b/src/main/java/io/kestra/plugin/dbt/cloud/AbstractDbtCloud.java @@ -15,15 +15,13 @@ import io.micronaut.http.client.netty.NettyHttpClientFactory; import io.micronaut.http.codec.MediaTypeCodecRegistry; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.ToString; +import lombok.*; import lombok.experimental.SuperBuilder; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; +import java.time.Duration; import javax.validation.constraints.NotNull; @SuperBuilder @@ -46,12 +44,17 @@ public abstract class AbstractDbtCloud extends Task { @NotNull String token; + private static final Duration HTTP_READ_TIMEOUT = Duration.ofSeconds(3); private static final NettyHttpClientFactory FACTORY = new NettyHttpClientFactory(); protected HttpClient client(RunContext runContext) throws IllegalVariableEvaluationException, MalformedURLException, URISyntaxException { MediaTypeCodecRegistry mediaTypeCodecRegistry = runContext.getApplicationContext().getBean(MediaTypeCodecRegistry.class); - DefaultHttpClient client = (DefaultHttpClient) FACTORY.createClient(URI.create("https://cloud.getdbt.com").toURL(), new DefaultHttpClientConfiguration()); + var httpConfig = new DefaultHttpClientConfiguration(); + httpConfig.setMaxContentLength(Integer.MAX_VALUE); + httpConfig.setReadTimeout(HTTP_READ_TIMEOUT); + + DefaultHttpClient client = (DefaultHttpClient) FACTORY.createClient(URI.create("https://cloud.getdbt.com").toURL(), httpConfig); client.setMediaTypeCodecRegistry(mediaTypeCodecRegistry); return client; From 3052ec4a6b62d2c90e1216f731b18df34aee06e0 Mon Sep 17 00:00:00 2001 From: Antoine Balliet Date: Thu, 5 Oct 2023 17:39:35 +0200 Subject: [PATCH 2/2] Update src/main/java/io/kestra/plugin/dbt/cloud/AbstractDbtCloud.java Co-authored-by: Ludovic DEHON --- src/main/java/io/kestra/plugin/dbt/cloud/AbstractDbtCloud.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/kestra/plugin/dbt/cloud/AbstractDbtCloud.java b/src/main/java/io/kestra/plugin/dbt/cloud/AbstractDbtCloud.java index 0f19221..cb71f2b 100644 --- a/src/main/java/io/kestra/plugin/dbt/cloud/AbstractDbtCloud.java +++ b/src/main/java/io/kestra/plugin/dbt/cloud/AbstractDbtCloud.java @@ -44,7 +44,7 @@ public abstract class AbstractDbtCloud extends Task { @NotNull String token; - private static final Duration HTTP_READ_TIMEOUT = Duration.ofSeconds(3); + private static final Duration HTTP_READ_TIMEOUT = Duration.ofSeconds(60); private static final NettyHttpClientFactory FACTORY = new NettyHttpClientFactory(); protected HttpClient client(RunContext runContext) throws IllegalVariableEvaluationException, MalformedURLException, URISyntaxException {