Last active
November 5, 2017 14:11
-
-
Save knightpop/c823aaeb2e44359dd8e6cc7db9e33162 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
/** | |
* Just use for comprehension | |
*/ | |
val start1: Instant = Instant.now | |
val fUserInfo1 = for { | |
nickname <- getNicknameById(userId) | |
emailAddr <- getEmailAddressByNickname(nickname) | |
accountInfo <- getAccountInfoByNickname(nickname) | |
} yield UserInfo(userId, nickname, emailAddr, accountInfo) | |
val userInfo1 = Await.result(fUserInfo1, 10 second) | |
val end1: Instant = Instant.now | |
println(printInterval(userInfo1, start1, end1)) // UserInfo(31337,ktz,helloworld@example.com,None) take 7 seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment