Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@marcospereira
Copy link
Member

Fixes

Fixes #8096.

Purpose

The request timeout should be Duration.Inf when play.server.akka.requestTimeout is null.

Copy link
Member

@gmethvin gmethvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

# How long a request takes until it times out
requestTimeout = null
# How long a request takes until it times out. Set to null or "infinite" to disable the timeout.
requestTimeout = "infinite"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it looks better without the quotes, since in this case "infinite" is meant to be a special value and not a literal string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Member

@richdougherty richdougherty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

I scanned the logic for Configuration.durationLoader and double-checked that null means Duration.Inf, so past behaviour should still be preserved.

@marcospereira
Copy link
Member Author

Thank you, @richdougherty. Your double-check made me check if we also have tests for durationLoader. We have:

import scala.concurrent.duration._
"support getting durations" in {
"simple duration" in {
val conf = config("my.duration" -> "10s")
conf.get[Duration]("my.duration") must beEqualTo(10.seconds)
}
"handle 'infinite' as Duration.Inf" in {
val conf = config("my.duration" -> "infinite")
conf.get[Duration]("my.duration") must beEqualTo(Duration.Inf)
}
"handle null as Duration.Inf" in {
val conf = config("my.duration" -> null)
conf.get[Duration]("my.duration") must beEqualTo(Duration.Inf)
}
}

I'm merging and backporting this now.

@marcospereira marcospereira merged commit cd3a76c into playframework:master Jan 9, 2018
marcospereira added a commit that referenced this pull request Jan 9, 2018
* Fix akka-http server configuration for request timeout

* Use "infinite" as the default value for timeouts
@marcospereira
Copy link
Member Author

Backport to 2.6.x: 4fd249d

@marcospereira marcospereira added this to the Play 2.6.11 milestone Jan 9, 2018
@marcospereira marcospereira deleted the fix-8096-akka-request-timeout branch January 17, 2018 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants