Skip to content

Commit

Permalink
Attempting to fix unexplained casing exception
Browse files Browse the repository at this point in the history
  • Loading branch information
NovaFox161 committed Mar 11, 2024
1 parent 7094d64 commit d3907b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import discord4j.rest.http.client.ClientException
import kotlinx.coroutines.reactor.awaitSingle
import kotlinx.coroutines.reactor.awaitSingleOrNull
import org.dreamexposure.discal.AnnouncementCache
import org.dreamexposure.discal.AnnouncementWizard
import org.dreamexposure.discal.AnnouncementWizardStateCache
import org.dreamexposure.discal.core.database.AnnouncementData
import org.dreamexposure.discal.core.database.AnnouncementRepository
Expand All @@ -15,7 +16,6 @@ import org.dreamexposure.discal.core.entities.Event
import org.dreamexposure.discal.core.extensions.discord4j.getCalendar
import org.dreamexposure.discal.core.logger.LOGGER
import org.dreamexposure.discal.core.`object`.new.Announcement
import org.dreamexposure.discal.core.`object`.new.WizardState
import org.springframework.beans.factory.BeanFactory
import org.springframework.beans.factory.getBean
import org.springframework.stereotype.Component
Expand Down Expand Up @@ -247,11 +247,11 @@ class AnnouncementService(
metricService.recordAnnouncementTaskDuration("guild", taskTimer.totalTimeMillis)
}

suspend fun getWizard(guildId: Snowflake, userId: Snowflake): WizardState<Announcement>? {
suspend fun getWizard(guildId: Snowflake, userId: Snowflake): AnnouncementWizard? {
return announcementWizardStateCache.get(guildId, userId)
}

suspend fun putWizard(state: WizardState<Announcement>) {
suspend fun putWizard(state: AnnouncementWizard) {
announcementWizardStateCache.put(state.guildId, state.userId, state)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class CacheConfig {
@Primary
@ConditionalOnProperty("bot.cache.redis", havingValue = "true")
fun announcementWizardRedisCache(objectMapper: ObjectMapper, redisTemplate: ReactiveStringRedisTemplate): AnnouncementWizardStateCache =
RedisStringCacheRepository(objectMapper, redisTemplate, "Wizards.Announcements", wizardTtl)
RedisStringCacheRepository(objectMapper, redisTemplate, "AnnouncementWizards", wizardTtl)


// In-memory fallback caching
Expand Down
4 changes: 3 additions & 1 deletion core/src/main/kotlin/org/dreamexposure/discal/typealiases.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ typealias CalendarCache = CacheRepository<Snowflake, Array<Calendar>>
typealias RsvpCache = CacheRepository<String, Rsvp>
typealias StaticMessageCache = CacheRepository<Snowflake, StaticMessage>
typealias AnnouncementCache = CacheRepository<Snowflake, Array<Announcement>>
typealias AnnouncementWizardStateCache = CacheRepository<Snowflake, WizardState<Announcement>>
typealias AnnouncementWizardStateCache = CacheRepository<Snowflake, AnnouncementWizard>

typealias AnnouncementWizard = WizardState<Announcement>

0 comments on commit d3907b1

Please sign in to comment.