added missing commit to loader

This commit is contained in:
2022-11-03 03:42:00 +01:00
parent 3e4b90a1bd
commit 7fda18a182

View File

@@ -512,19 +512,27 @@ func (dml *DemoMatchLoader) handleDemo(demo *Demo, apiKey string, rl *rate.Limit
for _, p := range players {
err = dml.cache.Delete(context.Background(), fmt.Sprintf(utils.SideMetaCacheKey, p.ID))
if err != nil {
err = utils.Rollback(tx, err)
return fmt.Errorf("error deleting cache key %s: %w", fmt.Sprintf(utils.SideMetaCacheKey, p.ID), err)
}
w, l, t, err := utils.GetWinLossTieForPlayer(p)
if err != nil {
err = utils.Rollback(tx, err)
return fmt.Errorf("error calculating WinLossTie for player %d: %w", p.ID, err)
}
err = p.Update().SetWins(w).SetTies(t).SetLooses(l).Exec(context.Background())
if err != nil {
err = utils.Rollback(tx, err)
return fmt.Errorf("error saving WinLossTie for player %d: %w", p.ID, err)
}
}
err = tx.Commit()
if err != nil {
return errors.Wrap(err, "[DP] error committing to db")
}
err = dml.dp.ParseDemo(demo)
if err != nil {
return fmt.Errorf("error queueing demo %d for parsing: %w", demo.MatchId, err)