Add buffer to inital throttle

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

View File

@ -71,9 +71,9 @@ class Captcha(throttle: Int) {
val task = new Runnable {
def run(): Unit = {
val imageNum = stmt.executeQuery("SELECT COUNT(*) AS total FROM challenge")
var throttleIn = throttle
var throttleIn = throttle + ((10*throttle)/100).asInstanceOf[Int]
if(imageNum.next())
throttleIn = (throttle-imageNum.getInt("total")) + ((10*throttle)/100).asInstanceOf[Int]
throttleIn = (throttleIn-imageNum.getInt("total"))
while(0 <= throttleIn-1){
getChallenge(Parameters("","","",Option(Size(0,0))))
throttleIn -= 1