armeria: HealthCheckedEndpointGroup should probably wait for connectTimeout before throwing exception.

Currently, HttpHealthCheckedEndpointGroup will throw an EndpointGroupException immediately when a request is attempted when there are no endpoints. It would be more intuitive and simpler to use if it was possible for the request to wait until ClientFactory.connectTImeout() before throwing the exception, allowing a health checked endpoint group to have similar connection behavior as just a single endpoint.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (1 by maintainers)

Commits related to this issue

Most upvoted comments

There are two things to fix for this issue:

  1. When selecting an Endpoint from an EndpointGroup, we need to wait up to certain amount of time (connect timeout) before raising an EmptyEndpointGroupException.
    • We need to add a variant of EndpointGroup.select() that requires a timeout value and returns a CompletableFuture<Endpoint>. The new method could be used when a) initializing a new context and b) RetryingClient chooses a new endpoint.
  2. Currently, on an EmptyEndpointGroupException, a request will always fail with a response whose failure cause is a UnprocessedRequestException, regardless of whether RetryingClient is present in a decorator chain or not. This behavior needs to change so that the successful re-attempts made by RetryingClient are passed to the caller.

Not sure this will be as easy as I described above (devils are always in details 😱). Any better ideas or traps I didn’t realize yet?

I’d like to target this issue for 1.0 again given its impact.