Created
November 6, 2018 11:25
-
-
Save AlexJHayward/a148b37612afdeebb20076aa50a3c6f0 to your computer and use it in GitHub Desktop.
A minimal example of request timeout not working with finatra
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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