imports: lock the import row so a retry and a new issue cannot interleaveVerifiedBrowse files at d12147a
Gurpal committed 11 days ago · 4 changed files
A retry checked for local issues and flipped the import back to pending in separate statements, and opening an issue checked the import outside its insert transaction, so an issue could slip in between and be overwritten by the retried import.
Opening an issue now takes a shared lock on the import row inside its insert transaction, and a retry locks the row for update and checks and transitions in one transaction. Whichever comes second waits and sees the other's result.