Skip to content

Commit

Permalink
Log used application commands cache
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 committed Nov 9, 2024
1 parent aa5fec7 commit 159b74b
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ internal open class ApplicationCommandsCacheFactoryProvider {
@Bean
@BService
internal open fun applicationCommandsCacheFactory(jda: JDA, applicationConfig: BApplicationConfig, database: InternalDatabase?): ApplicationCommandsCacheFactory {
val cacheConfig = applicationConfig.cache ?: return NullApplicationCommandsCacheFactory
val cacheConfig = applicationConfig.cache
?: return NullApplicationCommandsCacheFactory // Logged in [[BApplicationConfigBuilder#build]]

when (cacheConfig) {
is FileApplicationCommandsCacheConfig -> {
Expand All @@ -46,6 +47,7 @@ internal open class ApplicationCommandsCacheFactoryProvider {
return MemoryApplicationCommandsCacheFactory(cacheConfig)
}

logger.debug { "Using file-based application commands cache @ ${dataDirectory.pathString}" }
return FileApplicationCommandsCacheFactory(cacheConfig, jda.selfUser.applicationIdLong)
}
is DatabaseApplicationCommandsCacheConfig -> {
Expand All @@ -54,6 +56,7 @@ internal open class ApplicationCommandsCacheFactoryProvider {
return MemoryApplicationCommandsCacheFactory(cacheConfig)
}

logger.debug { "Using database-based application commands cache" }
return DatabaseApplicationCommandsCacheFactory(cacheConfig, database, jda.selfUser.applicationIdLong)
}
else -> throwInternal("Unsupported cache config: $cacheConfig")
Expand Down

0 comments on commit 159b74b

Please sign in to comment.