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:
Rahul Rudragoudar
2021-04-11 17:57:15 +05:30
committed by GitHub
parent ff666396b8
commit 4612dfa1cd
10 changed files with 126 additions and 3101 deletions

View File

@@ -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()) }
}
}