This commit is contained in:
dalbodeule 2024-08-14 21:13:13 +09:00
parent f13412d77a
commit ac2cd3725c
No known key found for this signature in database
GPG Key ID: EFA860D069C9FA65
2 changed files with 2 additions and 2 deletions

View File

@ -33,7 +33,7 @@ fun Route.apiDiscordRoutes() {
return@get
}
call.respond(HttpStatusCode.OK)
call.respond(HttpStatusCode.OK, DiscordGuildCache.getCachedGuilds(user.discord.toString())!!)
return@get
}
get {

View File

@ -16,7 +16,7 @@ object DiscordGuildCache {
private val cache = ConcurrentHashMap<String, CachedGuilds>()
private const val EXP_SECONDS = 600L
private suspend fun getCachedGuilds(guildId: String): Guild? {
suspend fun getCachedGuilds(guildId: String): Guild? {
val now = Instant.now()
if(cache.isEmpty() || !cache.containsKey(guildId) || cache[guildId]!!.timestamp.plusSeconds(EXP_SECONDS).isAfter(now)) {