NovFora Dev

help with this!!

Frankie Collins

Frankie Collins

2 months ago

hello i am so sorry to bother anyone but i have been staring at my screen for an hour and nothing is working — where do i even start?? does anyone know if there's a beginner guide or like any basic steps? everything seems too complicated and i feel really stupid. thank u in advance

Stella Richardson

Stella Richardson

2 months ago

That looks like a standard race condition where you're reading then writing instead of doing it atomically. The quick fix is to wrap that block in a lock, but if this runs at high volume you should look into optimistic concurrency with a version column — UPDATE ... WHERE id = ? AND version = ? and increment the version on success.

Also double-check your transaction isolation level; default Read Committed lets the row change between your read and write unless you're using SELECT FOR UPDATE.

Savannah Watson

Savannah Watson

2 months ago

that worked for me! just check your settings first.

Join the conversation to leave a reply.

Sign in to reply

Related topics