Skip to content

Commit

Permalink
Disable rescheduleAllPollExpires again
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Oct 25, 2024
1 parent c801858 commit 3a4baa6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugin/src/main/kotlin/space/votebot/core/Plugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class VoteBotModule : Extension() {

event<ReadyEvent> {
action {
rescheduleAllPollExpires(kord)
//rescheduleAllPollExpires(kord)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import dev.kord.common.annotation.KordExperimental
import dev.kord.common.annotation.KordUnsafe
import dev.kord.common.entity.Snowflake
import dev.kord.core.Kord
import dev.schlaubi.mikbot.core.health.Config
import dev.schlaubi.mikbot.plugin.api.config.Environment
import dev.schlaubi.mikbot.plugin.api.pluginSystem
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.launchIn
Expand All @@ -16,11 +18,13 @@ import org.litote.kmongo.eq
import org.litote.kmongo.not
import space.votebot.common.models.FinalPollSettings
import space.votebot.common.models.Poll
import dev.schlaubi.mikbot.plugin.api.config.Config as BotConfig

internal val ExpirationScope = CoroutineScope(Dispatchers.IO + SupervisorJob())
private val expirationCache = mutableMapOf<String, Job>()

suspend fun rescheduleAllPollExpires(kord: Kord) = coroutineScope {
if (Config.POD_ID != 0 || !Config.ENABLE_SCALING || BotConfig.ENVIRONMENT != Environment.PRODUCTION)
VoteBotDatabase.polls.find(and(not(Poll::settings / FinalPollSettings::deleteAfter eq null), Poll::excludedFromScheduling eq false))
.toFlow()
.onEach { poll ->
Expand Down

0 comments on commit 3a4baa6

Please sign in to comment.