mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
feat(stats): add MySQL relational storage and Redis atomic caching to GuildStats
- create guild_track_stats and guild_song_counts tables with composite time/guild indexes - wire MySQL shared promise pool and Redis manager to GuildStats in Bot.mjs - implement atomic Redis counters and ZINCRBY sorted sets for real-time leaderboard queries - add async SQL queries for %top timeframes (week, month, all) and %wrapped recap calculations\
This commit is contained in:
1 parent
04ce02f672
commit
452c080224
4 files changed
+375
-41
No files matched your search
+2
-2
@@ -49,8 +49,8 @@ export async function run(message, data) {
|
||||
}
|
||||
|
||||
const { tracks, topArtist } = isGlobal
|
||||
? GuildStats.getGlobalTopTracks(10)
|
||||
: GuildStats.getTopTracks(guildId, timeframe, 10);
|
||||
? await GuildStats.getGlobalTopTracks(10)
|
||||
: await GuildStats.getTopTracks(guildId, timeframe, 10);
|
||||
|
||||
const authorName = isGlobal
|
||||
? `🌐 ${this.t(message, "responses.top.globalAuthor")}`
|
||||
|
||||
@@ -42,7 +42,7 @@ export async function run(message, data) {
|
||||
|
||||
if (isGlobal) {
|
||||
const serverCount = this.client?.guilds?.size ?? 1300;
|
||||
const stats = GuildStats.getGlobalWrapped(serverCount);
|
||||
const stats = await GuildStats.getGlobalWrapped(serverCount);
|
||||
|
||||
if (!stats) {
|
||||
const emptyEmbed = new EmbedBuilder()
|
||||
@@ -102,7 +102,7 @@ export async function run(message, data) {
|
||||
return message.reply({ embeds: [embed] });
|
||||
}
|
||||
|
||||
const stats = GuildStats.getWrapped(guildId);
|
||||
const stats = await GuildStats.getWrapped(guildId);
|
||||
|
||||
if (!stats) {
|
||||
const emptyEmbed = new EmbedBuilder()
|
||||
|
||||
Reference in new issue
Block a user