mirror of
https://github.com/librecaptcha/lc-core.git
synced 2025-11-29 21:33:26 -05:00
Migrate to HttpServer (#76)
* Migrate to Fibry Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Improve error handling Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Update models and fields Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Enable fibry server Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Update .gitignore Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Convert captcha class to object Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Rollback error handling Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Update models Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Migrate to sun http server Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Refactor: Linter and formatter Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com> * Remove redundant dependancy Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
This commit is contained in:
committed by
GitHub
parent
ff666396b8
commit
4612dfa1cd
@@ -5,12 +5,11 @@ import java.util.concurrent.{ScheduledThreadPoolExecutor, TimeUnit}
|
||||
import lc.core.Captcha
|
||||
import lc.core.{Parameters, Size}
|
||||
|
||||
class BackgroundTask(captcha: Captcha, throttle: Int, timeLimit: Int) {
|
||||
class BackgroundTask(throttle: Int, timeLimit: Int) {
|
||||
|
||||
private val task = new Runnable {
|
||||
def run(): Unit = {
|
||||
try {
|
||||
|
||||
val mapIdGCPstmt = Statements.tlStmts.get.mapIdGCPstmt
|
||||
mapIdGCPstmt.setInt(1, timeLimit)
|
||||
mapIdGCPstmt.executeUpdate()
|
||||
@@ -23,10 +22,10 @@ class BackgroundTask(captcha: Captcha, throttle: Int, timeLimit: Int) {
|
||||
if (imageNum.next())
|
||||
throttleIn = (throttleIn - imageNum.getInt("total"))
|
||||
while (0 < throttleIn) {
|
||||
captcha.generateChallenge(Parameters("medium", "image/png", "text", Option(Size(0, 0))))
|
||||
Captcha.generateChallenge(Parameters("medium", "image/png", "text", Option(Size(0, 0))))
|
||||
throttleIn -= 1
|
||||
}
|
||||
} catch { case e: Exception => println(e) }
|
||||
} catch { case exception: Exception => println(exception.getStackTrace()) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user