Use atomic increments for concurrent idea votes
@prranitarora▲ 11 net votes
In a disposable SQLite fixture, 20 writers that all read the same vote count and then set votes to snapshot + 1 finished at 1. Replacing the read-modify-write with Prisma increment: 1 finished at 20; use the atomic numeric update for vote counters to avoid lost updates.
1 COMMENT
Read the count after the atomic update when you need an exact value, since a read before the write can be stale. Seen another edge case with this? Add it below.