From cd6c8d790a0f65d33de5a43d155e1d57e1f321e0 Mon Sep 17 00:00:00 2001 From: hrj Date: Tue, 5 Apr 2022 09:53:58 +0530 Subject: [PATCH] renamed throttle config option to `bufferCount` --- src/main/scala/lc/background/taskThread.scala | 2 +- src/main/scala/lc/core/captchaFields.scala | 2 +- src/main/scala/lc/core/config.scala | 4 ++-- src/main/scala/lc/core/models.scala | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/scala/lc/background/taskThread.scala b/src/main/scala/lc/background/taskThread.scala index 8b1ca5c..6477207 100644 --- a/src/main/scala/lc/background/taskThread.scala +++ b/src/main/scala/lc/background/taskThread.scala @@ -19,7 +19,7 @@ class BackgroundTask(config: Config, captchaManager: CaptchaManager) { challengeGCPstmt.executeUpdate() val allCombinations = allParameterCombinations() - val requiredCountPerCombination = Math.max(1, (config.throttle * 1.01) / allCombinations.size).toInt + val requiredCountPerCombination = Math.max(1, (config.bufferCount * 1.01) / allCombinations.size).toInt for (param <- allCombinations) { if (!shutdownInProgress) { diff --git a/src/main/scala/lc/core/captchaFields.scala b/src/main/scala/lc/core/captchaFields.scala index ee0285c..e147868 100644 --- a/src/main/scala/lc/core/captchaFields.scala +++ b/src/main/scala/lc/core/captchaFields.scala @@ -21,7 +21,7 @@ object AttributesEnum extends Enumeration { val PORT: Value = Value("port") val ADDRESS: Value = Value("address") val CAPTCHA_EXPIRY_TIME_LIMIT: Value = Value("captchaExpiryTimeLimit") - val THROTTLE: Value = Value("throttle") + val BUFFER_COUNT: Value = Value("throttle") val THREAD_DELAY: Value = Value("threadDelay") val PLAYGROUND_ENABLED: Value = Value("playgroundEnabled") val CORS_HEADER: Value = Value("corsHeader") diff --git a/src/main/scala/lc/core/config.scala b/src/main/scala/lc/core/config.scala index dfbab88..970a5ec 100644 --- a/src/main/scala/lc/core/config.scala +++ b/src/main/scala/lc/core/config.scala @@ -45,7 +45,7 @@ class Config(configFilePath: String) { val port: Int = configFields.portInt.getOrElse(8888) val address: String = configFields.address.getOrElse("0.0.0.0") - val throttle: Int = configFields.throttleInt.getOrElse(1000) + val bufferCount: Int = configFields.bufferCountInt.getOrElse(1000) val seed: Int = configFields.seedInt.getOrElse(375264328) val captchaExpiryTimeLimit: Int = configFields.captchaExpiryTimeLimitInt.getOrElse(5) val threadDelay: Int = configFields.threadDelayInt.getOrElse(2) @@ -70,7 +70,7 @@ class Config(configFilePath: String) { (AttributesEnum.PORT.toString -> 8888) ~ (AttributesEnum.ADDRESS.toString -> "0.0.0.0") ~ (AttributesEnum.CAPTCHA_EXPIRY_TIME_LIMIT.toString -> 5) ~ - (AttributesEnum.THROTTLE.toString -> 1000) ~ + (AttributesEnum.BUFFER_COUNT.toString -> 1000) ~ (AttributesEnum.THREAD_DELAY.toString -> 2) ~ (AttributesEnum.PLAYGROUND_ENABLED.toString -> true) ~ (AttributesEnum.CORS_HEADER.toString -> "") ~ diff --git a/src/main/scala/lc/core/models.scala b/src/main/scala/lc/core/models.scala index f496d57..a090892 100644 --- a/src/main/scala/lc/core/models.scala +++ b/src/main/scala/lc/core/models.scala @@ -23,7 +23,7 @@ case class CaptchaConfig( case class ConfigField( port: Option[Integer], address: Option[String], - throttle: Option[Integer], + bufferCount: Option[Integer], seed: Option[Integer], captchaExpiryTimeLimit: Option[Integer], threadDelay: Option[Integer], @@ -32,7 +32,7 @@ case class ConfigField( maxAttempts: Option[Integer] ) { lazy val portInt: Option[Int] = mapInt(port) - lazy val throttleInt: Option[Int] = mapInt(throttle) + lazy val bufferCountInt: Option[Int] = mapInt(bufferCount) lazy val seedInt: Option[Int] = mapInt(seed) lazy val captchaExpiryTimeLimitInt: Option[Int] = mapInt(captchaExpiryTimeLimit) lazy val threadDelayInt: Option[Int] = mapInt(threadDelay)