Last active
November 5, 2017 14:11
-
-
Save knightpop/842e4e2d8017884b5ce9ea12c18b3a16 to your computer and use it in GitHub Desktop.
This file contains 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
case class UserInfo(userId: Int, nickname: String, emailAddress: String, account: Option[Long]) | |
def getNicknameById(userId: Int): Future[String] = Future { | |
Thread.sleep(2000) | |
"ktz" | |
} | |
def getEmailAddressByNickname(nickname: String): Future[String] = Future { | |
Thread.sleep(2000) | |
"helloworld@example.com" | |
} | |
def getAccountInfoByNickname(nickname: String): Future[Option[Long]] = Future { | |
Thread.sleep(3000) | |
None | |
} | |
def printInterval(userInfo: UserInfo, start: Instant, end: Instant): String = | |
s"$userInfo take ${(end.toEpochMilli - start.toEpochMilli) / 1000} seconds" | |
val userId: Int = 31337 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment