feat(xp): increase precision of timestamp
seems like to fix periodic reducer not working
This commit is contained in:
parent
cf2093095e
commit
026abcc07a
5 changed files with 20 additions and 33 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue