Unable to override default timeout for hystrix.
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.8k
- Forks
- 1.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 41
Description
I am using combination of (open-feign) and (feign-hystrix) to communicate with another micro service. For some requests, It's taking longer(3s) to get a response and as a result I am getting hystrix runtime exception saying "getting timed out and no fall back available". So inorder to bump up the timeout I have added the following property in the yml file
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 10000
But feign is not considering the timeout mentioned in the yml file. I have also tried using the Request.options but was unsuccessful in that as well. Is there any configuration that I have to do to override the default timeout?
@Builder
public class FeignBasicConfig {
Builder baseFeignConfig() {
return HystrixFeign.builder()
.encoder(new JacksonEncoder(objectMapper))
.decoder(new JacksonDecoder(objectMapper))
.options(new Options(5000L, TimeUnit.MILLISECONDS, 5000L, TimeUnit.MILLISECONDS, false))
.retryer(new Retryer.Default(200, SECONDS.toMillis(5), 5));
}
}
@Configuration
@RequiredArgsConstructor
public class UsersClientConfig {
private final FeignConfig feignConfig;
@Bean
public UsersClient usersClient(
@Value("${services.usersClient.baseUrl:#{null}}") String url,
@Value("${services.usersClient.username:#{null}}") String username,
@Value("${services.usersClient.password:#{null}}") String password) {
return feignConfig
.baseFeignConfig()
.requestInterceptor(new BasicAuthRequestInterceptor(username,password))
.target(UsersClient.class, url);
}
}
public interface UsersClient {
@RequestLine("GET /users/{userId}")
CompletableFuture<UsersClientDto> getUserById(@Param("userId") String userId);
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the HystrixFeign builder and Options configuration in FeignBasicConfig, then follow how UsersClientConfig creates the client and how UsersClient requests are executed. Compare the Hystrix timeout property with the configured Feign request options; done means the intended timeout is applied consistently and the behavior is documented or covered for this client setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100