Skip to content

Commit d980e86

Browse files
committed
faster PlayApp.startedSince*
1 parent 8377a5b commit d980e86

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/common/src/main/PlayApp.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ import scala.collection.JavaConversions._
99
object PlayApp {
1010

1111
val startedAt = DateTime.now
12+
val startedAtMillis = nowMillis
1213

1314
def uptime = new Period(startedAt, DateTime.now)
1415

1516
def startedSinceMinutes(minutes: Int) =
16-
startedAt.isBefore(DateTime.now minusMinutes minutes)
17+
startedSinceSeconds(minutes * 60)
1718

1819
def startedSinceSeconds(seconds: Int) =
19-
startedAt.isBefore(DateTime.now minusSeconds seconds)
20+
startedAtMillis < (nowMillis - (seconds * 1000))
2021

2122
def loadConfig: Config = withApp(_.configuration.underlying)
2223

0 commit comments

Comments
 (0)