Fixes T8277. Transforming files can race; resolve the race after we lose.
- Maniphest Tasks
- T8277: Image transformation may race itself for long/slow transforms
- Restricted Diffusion Commit
rPd70ca6b7c8b5: When file transforms race and lose, accept defeat gracefully
- Added sleep(10) near the bottom of the transform controller.
- Transformed a file in two browser windows at the same time; got something like this (exception corresponds to the loser of the race):
- Applied patch.
- Repeated process, got this:
My thinking on 404 is that we "should" only get here if the thing was just deleted, and we'd 404 if we were a fraction of a second quicker (on line 105, or after redirecting on line 111), and 404'ing in those cases makes fairly good sense to me.
In theory, we don't need to 404 here and could just loop back to the top and rebuild the transform, or loop here trying to either save our own transform or load a conflicting one, but those are both complicated and introduce the possibility that we might loop forever if there's a bug somewhere.