From 61e0b7b961be3759cf24bf052b8bbf0f6feeb78c Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Fri, 4 Jan 2019 13:00:21 +0100 Subject: [PATCH] pull-requests: increase stability of concurrent pull requests creation by flushing prematurly the statuses of commits. This is required to increase the versions on each concurrent call. Otherwise we could get into an integrity errors of commitsha+version+repo --- rhodecode/model/changeset_status.py | 1 + rhodecode/model/pull_request.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rhodecode/model/changeset_status.py b/rhodecode/model/changeset_status.py index da7a66aa..a6ef2e84 100644 --- a/rhodecode/model/changeset_status.py +++ b/rhodecode/model/changeset_status.py @@ -312,6 +312,7 @@ class ChangesetStatusModel(BaseModel): for st in cur_statuses: st.version += 1 Session().add(st) + Session().flush() def _create_status(user, repo, status, comment, revision, pull_request): new_status = ChangesetStatus() diff --git a/rhodecode/model/pull_request.py b/rhodecode/model/pull_request.py index 730801db..1ac13a27 100644 --- a/rhodecode/model/pull_request.py +++ b/rhodecode/model/pull_request.py @@ -493,7 +493,7 @@ class PullRequestModel(BaseModel): ) # we commit early at this point. This has to do with a fact # that before queries do some row-locking. And because of that - # we need to commit and finish transation before below validate call + # we need to commit and finish transaction before below validate call # that for large repos could be long resulting in long row locks Session().commit()