Skip to content

Commit 1d89563

Browse files
committed
Add comment explaining the use of blocking
1 parent 04e9970 commit 1d89563

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

scalajvm/app/helpers/ReCaptcha.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class ReCaptcha @Inject()(implicit configuration: Configuration) {
1818

1919
def check(addr: String, response: String): Future[Boolean] = {
2020
val request = Http(verificationUrl).params("secret" -> privateKey, "response" -> response, "remoteip" -> addr)
21+
// scalaj-http is a synchronous library, so calling `asString` will block the executor's thread - which is why we annotate the call with `blocking`
2122
val result = Future { blocking { request.asString.body } }
2223
result.map { res => Json.parse(res).get("success").asBoolean() } // TODO: Proper error handling, check recaptcha documentation
2324
}

0 commit comments

Comments
 (0)