Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feaat: increase read timeout and setMaxContentLength to MAX_VALUE #72

Merged
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
13 changes: 8 additions & 5 deletions src/main/java/io/kestra/plugin/dbt/cloud/AbstractDbtCloud.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -46,12 +44,17 @@ public abstract class AbstractDbtCloud extends Task {
@NotNull
String token;

private static final Duration HTTP_READ_TIMEOUT = Duration.ofSeconds(3);
aballiet marked this conversation as resolved.
Show resolved Hide resolved
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;
Expand Down
Loading