added missing commit to loader
This commit is contained in:
@@ -512,19 +512,27 @@ func (dml *DemoMatchLoader) handleDemo(demo *Demo, apiKey string, rl *rate.Limit
|
|||||||
for _, p := range players {
|
for _, p := range players {
|
||||||
err = dml.cache.Delete(context.Background(), fmt.Sprintf(utils.SideMetaCacheKey, p.ID))
|
err = dml.cache.Delete(context.Background(), fmt.Sprintf(utils.SideMetaCacheKey, p.ID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err = utils.Rollback(tx, err)
|
||||||
return fmt.Errorf("error deleting cache key %s: %w", fmt.Sprintf(utils.SideMetaCacheKey, p.ID), err)
|
return fmt.Errorf("error deleting cache key %s: %w", fmt.Sprintf(utils.SideMetaCacheKey, p.ID), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
w, l, t, err := utils.GetWinLossTieForPlayer(p)
|
w, l, t, err := utils.GetWinLossTieForPlayer(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err = utils.Rollback(tx, err)
|
||||||
return fmt.Errorf("error calculating WinLossTie for player %d: %w", p.ID, 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())
|
err = p.Update().SetWins(w).SetTies(t).SetLooses(l).Exec(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err = utils.Rollback(tx, err)
|
||||||
return fmt.Errorf("error saving WinLossTie for player %d: %w", p.ID, 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)
|
err = dml.dp.ParseDemo(demo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error queueing demo %d for parsing: %w", demo.MatchId, err)
|
return fmt.Errorf("error queueing demo %d for parsing: %w", demo.MatchId, err)
|
||||||
|
Reference in New Issue
Block a user