Minor fixes

Signed-off-by: Rahul Rudragoudar <rr83019@gmail.com>
This commit is contained in:
Rahul Rudragoudar 2019-04-06 23:26:51 +05:30
parent 184d167085
commit 89a1039c87
No known key found for this signature in database
GPG Key ID: 5825856C50762765

View File

@ -71,10 +71,10 @@ class Captcha(throttle: Int) {
val task = new Runnable { val task = new Runnable {
def run(): Unit = { def run(): Unit = {
val imageNum = stmt.executeQuery("SELECT COUNT(*) AS total FROM challenge") val imageNum = stmt.executeQuery("SELECT COUNT(*) AS total FROM challenge")
var throttleIn = throttle + ((10*throttle)/100).asInstanceOf[Int] var throttleIn = (throttle*1.1).toInt
if(imageNum.next()) if(imageNum.next())
throttleIn = (throttleIn-imageNum.getInt("total")) throttleIn = (throttleIn-imageNum.getInt("total"))
while(0 <= throttleIn-1){ while(0 < throttleIn){
getChallenge(Parameters("","","",Option(Size(0,0)))) getChallenge(Parameters("","","",Option(Size(0,0))))
throttleIn -= 1 throttleIn -= 1
} }
@ -171,8 +171,8 @@ object LCFramework{
def main(args: scala.Array[String]) { def main(args: scala.Array[String]) {
val captcha = new Captcha(50) val captcha = new Captcha(50)
val server = new Server(8888) val server = new Server(8888)
server.start()
captcha.beginThread(2) captcha.beginThread(2)
server.start()
} }
} }