Last active
June 21, 2018 23:05
-
-
Save JohnMurray/55c2fe201819286d6184939b2b6f8a1f to your computer and use it in GitHub Desktop.
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
class ApiService [T] { | |
// other code ... | |
private def makeRequest(): Unit = { | |
val now = LocalDateTime.now() | |
var req: RequestQueueItem = null | |
var foundValidRequest = false | |
do { | |
req = requestQueue.pollFirst() | |
if (req == null) return | |
foundValidRequest = req.startDeadline.forall(now.isBefore) | |
} while(!foundValidRequest) | |
// other code ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment