Skip to content

Instantly share code, notes, and snippets.

@JohnMurray
Last active June 21, 2018 23:05
Show Gist options
  • Save JohnMurray/55c2fe201819286d6184939b2b6f8a1f to your computer and use it in GitHub Desktop.
Save JohnMurray/55c2fe201819286d6184939b2b6f8a1f to your computer and use it in GitHub Desktop.
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