Skip to content

Commit

Permalink
Update preserve flag outside of transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Jan 24, 2024
1 parent d21dd07 commit a065cd2
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,17 @@ protected override void ProcessResult(ScoreItem item)

updateHistoryEntry(item, conn, transaction);

if (score.Passed)
{
// For now, just assume all passing scores are to be preserved.
conn.Execute("UPDATE scores SET preserve = 1 WHERE id = @Id", new { Id = score.ID }, transaction);
}

transaction.Commit();
}

// Intentionally not part of the transaction to avoid deadlocks.
// See https://discord.com/channels/90072389919997952/983550677794050108/1199725169573380136
if (score.Passed)
{
// For now, just assume all passing scores are to be preserved.
conn.Execute("UPDATE scores SET preserve = 1 WHERE id = @Id", new { Id = score.ID });
}

foreach (var p in enumerateValidProcessors(score))
p.ApplyGlobal(score, conn);
}
Expand Down

0 comments on commit a065cd2

Please sign in to comment.