PRX / feeder.prx.org

Dovetail podcast content management system
https://podcasts.dovetail.prx.org
GNU Affero General Public License v3.0
5 stars 0 forks source link

Cautiously optimistic locking (attempt 2) #1012

Closed cavis closed 2 months ago

cavis commented 3 months ago

Redoing #1006.

We were hitting issues in prod where users could not upload files. The server was throwing :conflicts, but failing to render the modal. Plus nobody else had edited the object in the background.

This appeared to be a combination of:

  1. The default lock_version for these tables in the db is NULL. Which rails casts to 0 - but for some reason this was tripping/failing the constraint rails uses when incrementing the column.
  2. Saving a nested form object (such as images/audio) without changing anything on the parent Podcast/Feed/Episode.

Setting a default of 0 in the migration seems to resolve the issue for me. That's the only change I've made to #1006.