OpenFeign / OpenFeign/feign

OkHttp connect and read timeouts overwritten by feign

Open
#781 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
Java
Stars
9.8k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
41

Description

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?

https://github.com/OpenFeign/feign/blob/32372293454dbcc7797f758586e7da1617b88fd3/okhttp/src/main/java/feign/okhttp/OkHttpClient.java#L158

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);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at okhttp/src/main/java/feign/okhttp/OkHttpClient.java around line 158 and reproduce the supplied Feign.builder example with a preconfigured OkHttpClient. Compare the resulting timeouts when no Feign options are set; done means the configured OkHttpClient timeouts are no longer unexpectedly overwritten, or the intentional override is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.