Skip to content

OkHttp connect and read timeouts overwritten by feign #781

Open
@rmatec

Description

@rmatec

The connect and read timeout configuration in the OkHttpClient is overwritten by feign in the code below when no options are set in feign.
Is there any specific reason to do it?

if (delegate.connectTimeoutMillis() != options.connectTimeoutMillis()

This is some code example where the OkHttpClient timeout configuration is ignored and the default feign values are used instead.

        OkHttpClient client = unsafeHttpClient().newBuilder()
                                                .readTimeout(130, TimeUnit.SECONDS)
                                                .writeTimeout(130, `TimeUnit.SECONDS)
                                                .build();

        return Feign.builder()
                    .errorDecoder(new EdocErrorDecoder(objectMapper()))
                    .encoder(new FormEncoder())
                    .decoder(new JacksonDecoder(objectMapper()))
                    .logger(new Slf4jLogger())
                    .client(new feign.okhttp.OkHttpClient(client))
                    .target(MyService.class, myServiceUrl);

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationIssues that require updates to our documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions