Skip to content

Commit

Permalink
Added Delay Mechanism for retrieving Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Artraxon committed Apr 29, 2020
1 parent d61578b commit d1dcce2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

project.version = "2.0"
project.version = "2.1"
plugins {
id("org.jetbrains.kotlin.jvm") version "1.3.41"

Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/de/rtrx/a/Configuration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ object RedditSpec: ConfigSpec("reddit") {
val forTimes by required<Int>()
val comments_amount by required<Int>()
val depth by required<Int>()
val commentWaitIntervall by required<Long>()
}
}

Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/de/rtrx/a/monitor/DBCheck.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class DBCheck(
//Pulls comments until the value specified in the configuration is reached or no more comments can be found
var newComments: List<ReplyCommentNode>? = null
while (size < config[RedditSpec.checks.DB.comments_amount] && newComments?.isNotEmpty() ?: true) {
delay(config[RedditSpec.checks.DB.commentWaitIntervall])
newComments = replaceMore(redditClient)
size += newComments.size
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ reddit:
forTimes: 8
comments_amount: 20
depth: 10
commentWaitIntervall: 10000

DB:
password: ""
Expand Down

0 comments on commit d1dcce2

Please sign in to comment.