Skip to content

Instantly share code, notes, and snippets.

@AlexJHayward
Created November 6, 2018 11:25
Show Gist options
  • Save AlexJHayward/a148b37612afdeebb20076aa50a3c6f0 to your computer and use it in GitHub Desktop.
Save AlexJHayward/a148b37612afdeebb20076aa50a3c6f0 to your computer and use it in GitHub Desktop.
A minimal example of request timeout not working with finatra
import com.twitter.conversions.time._
import com.twitter.finagle.Http
import com.twitter.finagle.http.Request
import com.twitter.finatra.http.routing.HttpRouter
import com.twitter.util.Future
object Application extends Server {}
class Server extends com.twitter.finatra.http.HttpServer {
override protected def configureHttp(router: HttpRouter): Unit = {
router.add(new Controller)
}
override protected def configureHttpServer(server: Http.Server): Http.Server = {
server.withRequestTimeout(3.seconds)
}
override protected def defaultHttpPort: String = ":8080"
}
class Controller extends com.twitter.finatra.http.Controller {
get("/test") { request: Request =>
Future {
Thread.sleep(6000L)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment