feat(xp): increase precision of timestamp

seems like to fix periodic reducer not working
This commit is contained in:
Anhgelus Morhtuuzh 2025-08-18 13:56:32 +02:00
parent cf2093095e
commit 026abcc07a
Signed by: anhgelus
GPG key ID: CAD341EFA92DDDE5
5 changed files with 20 additions and 33 deletions

View file

@ -86,14 +86,14 @@ func PeriodicReducer(dg *discordgo.Session) {
go func() {
defer wg.Done()
cfg := config.GetGuildConfig(g.ID)
err := gokord.DB.
res := gokord.DB.
Model(&CopaingXP{}).
Where("guild_id = ? and created_at < ?", g.ID, exp.TimeStampNDaysBefore(cfg.DaysXPRemains)).
Delete(&CopaingXP{}).
Error
if err != nil {
utils.SendAlert("user/level.go - Removing old XP", err.Error(), "guild_id", g.ID)
Delete(&CopaingXP{})
if res.Error != nil {
utils.SendAlert("user/level.go - Removing old XP", res.Error.Error(), "guild_id", g.ID)
}
utils.SendDebug("Guild cleaned", "guild", g.Name, "rows affected", res.RowsAffected)
}()
}
wg.Wait()