HomePhabricator

LocalFile: schedule jobs after transaction.

Description

LocalFile: schedule jobs after transaction.

Jobs and deferred updates must not be scheduled from within a
transaction. The code already had a comment documenting the intent to
avoid doing that, but it failed to consider that another atomic section
was opened further up the stack by calling code. This is now fixed by
moving code for scheduling updates into a onTransactionCommitOrIdle
callback.

NOTE: this does not prevent data corruption by rollbacks in recordUpload3(). But it makes such rollbacks less likely to occur. It also avoids execution of deferred updates and jobs after an error that cause a rollback.

I confirmed the following by manual testing:

  • uploads and re-uploads work as expected
  • an exception thrown while trying to push a job no longer causes data corruption.
  • an exception thrown inside the transaction prevents any jobs or deferred updates from being scheduled.

Bug: T263301
Change-Id: I00e55c12c39c8e212ee5097117fd8c6680e5871b

Details

Provenance
danielAuthored on Jan 8 2021, 11:03 AM
Parents
rMW6ca4b5320cc6: Merge "Fix error handling in TextSlotDiffRenderer::getTextDiffInternal()"
Branches
Unknown
Tags
Unknown
ChangeId
I00e55c12c39c8e212ee5097117fd8c6680e5871b

Event Timeline