1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00

Recheck if revision hasn't been already closed in commit parser

Summary:
If attaching a commit or checking if there are any changes takes nonzero time then the revision may be closed by someone else.

Cleaner solution would be to do it inside a transaction and mark the SELECT as FOR UPDATE but it would be blocking.

Test Plan: Patched `$should_close` to be true, reparsed an already closed commit.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3555
This commit is contained in:
vrana 2012-09-26 11:57:03 -07:00
parent f1d4755c61
commit 7ed8b6d7fa

View file

@ -169,7 +169,11 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
$editor->setChangedByCommit($changed_by_commit);
}
$editor->setMessage($message)->save();
// Reload revision to check if someone already didn't close it.
$current = id(new DifferentialRevision())->load($revision_id);
if ($current->getStatus() != $status_closed) {
$editor->setMessage($message)->save();
}
}
}