Skip to content

Instantly share code, notes, and snippets.

@akirillov
Created October 7, 2014 13:06
Show Gist options
  • Save akirillov/55025b30bd910f4077b3 to your computer and use it in GitHub Desktop.
Save akirillov/55025b30bd910f4077b3 to your computer and use it in GitHub Desktop.
Finagle default HttpClient configured with timeouts and retry filters
val retry = new RetryingFilter[HttpRequest, HttpResponse](
retryPolicy = RetryPolicy.tries(3),
timer = DefaultTimer.twitter
)
val timeout = new TimeoutFilter[HttpRequest, HttpResponse](
timeout = 3.seconds,
timer = DefaultTimer.twitter
)
private lazy val client = retry andThen timeout andThen Http.newService(servers.mkString(","))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment