diff --git a/loritta-bot-discord/src/main/kotlin/net/perfectdreams/loritta/morenitta/analytics/MagicStats.kt b/loritta-bot-discord/src/main/kotlin/net/perfectdreams/loritta/morenitta/analytics/MagicStats.kt index 5ae69857cc..d03cb9a823 100644 --- a/loritta-bot-discord/src/main/kotlin/net/perfectdreams/loritta/morenitta/analytics/MagicStats.kt +++ b/loritta-bot-discord/src/main/kotlin/net/perfectdreams/loritta/morenitta/analytics/MagicStats.kt @@ -58,7 +58,7 @@ class MagicStats(val loritta: LorittaBot) : RunnableCoroutine { it[TotalSonhosStats.totalSonhosBroker] = totalSonhosBroker } } - + val mb = 1024 * 1024 val runtime = Runtime.getRuntime() val freeMemory = runtime.freeMemory() / mb @@ -82,9 +82,10 @@ class MagicStats(val loritta: LorittaBot) : RunnableCoroutine { val shardManager = loritta.lorittaShards.shardManager LorittaDiscordShardStats.batchInsert(shardManager.shardCache, shouldReturnGeneratedValues = false) { this[LorittaDiscordShardStats.timestamp] = now + this[LorittaDiscordShardStats.clusterId] = loritta.clusterId this[LorittaDiscordShardStats.shardId] = it.shardInfo.shardId - this[LorittaDiscordShardStats.status] = it.status.name - this[LorittaDiscordShardStats.gatewayStartupResumeStatus] = loritta.gatewayShardsStartupResumeStatus[it.shardInfo.shardId]?.name + this[LorittaDiscordShardStats.status] = it.status.ordinal + this[LorittaDiscordShardStats.gatewayStartupResumeStatus] = loritta.gatewayShardsStartupResumeStatus[it.shardInfo.shardId]?.ordinal this[LorittaDiscordShardStats.gatewayPing] = it.gatewayPing this[LorittaDiscordShardStats.responseTotal] = it.responseTotal this[LorittaDiscordShardStats.guildsCount] = it.guildCache.size() diff --git a/pudding/client/src/main/kotlin/net/perfectdreams/loritta/cinnamon/pudding/Pudding.kt b/pudding/client/src/main/kotlin/net/perfectdreams/loritta/cinnamon/pudding/Pudding.kt index 4c85fdd712..31e9740b90 100644 --- a/pudding/client/src/main/kotlin/net/perfectdreams/loritta/cinnamon/pudding/Pudding.kt +++ b/pudding/client/src/main/kotlin/net/perfectdreams/loritta/cinnamon/pudding/Pudding.kt @@ -69,7 +69,7 @@ class Pudding( private val DRIVER_CLASS_NAME = "org.postgresql.Driver" private val ISOLATION_LEVEL = IsolationLevel.TRANSACTION_REPEATABLE_READ // We use repeatable read to avoid dirty and non-repeatable reads! Very useful and safe!! - private const val SCHEMA_VERSION = 64 // Bump this every time any table is added/updated! + private const val SCHEMA_VERSION = 65 // Bump this every time any table is added/updated! private val SCHEMA_ID = UUID.fromString("600556aa-2920-41c7-b26c-7717eff2d392") // This is a random unique ID, it is used for upserting the schema version /** diff --git a/pudding/client/src/main/kotlin/net/perfectdreams/loritta/cinnamon/pudding/tables/stats/LorittaDiscordShardStats.kt b/pudding/client/src/main/kotlin/net/perfectdreams/loritta/cinnamon/pudding/tables/stats/LorittaDiscordShardStats.kt index e45b8d1104..b048da338b 100644 --- a/pudding/client/src/main/kotlin/net/perfectdreams/loritta/cinnamon/pudding/tables/stats/LorittaDiscordShardStats.kt +++ b/pudding/client/src/main/kotlin/net/perfectdreams/loritta/cinnamon/pudding/tables/stats/LorittaDiscordShardStats.kt @@ -5,9 +5,12 @@ import org.jetbrains.exposed.dao.id.LongIdTable object LorittaDiscordShardStats : LongIdTable() { val timestamp = timestampWithTimeZone("timestamp").index() + val clusterId = integer("cluster_id").index() val shardId = integer("shard_id").index() - val status = text("status") - val gatewayStartupResumeStatus = text("gateway_startup_resume_status").nullable() + // We don't use enumerations because we don't have access to JDA.Status nor the GW Startup Resume Status here + // And we can't use text because they are BIG and FAT + val status = integer("status") + val gatewayStartupResumeStatus = integer("gateway_startup_resume_status").nullable() val gatewayPing = long("gateway_ping") val responseTotal = long("response_total") val guildsCount = long("guild_count")