diff options
author | Nick Thomas <nick@gitlab.com> | 2019-06-21 17:56:47 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-07-04 08:50:55 +0100 |
commit | 381468d0cc6e5b528a4b2207c0a534569035a73f (patch) | |
tree | 2ffc9e9062fef50a7cca8dfd8d0b5733e8cf4c9d /lib | |
parent | 9ef0c8559de925d0a72a3fe421d95209c2b81d8f (diff) | |
download | gitlab-ce-381468d0cc6e5b528a4b2207c0a534569035a73f.tar.gz |
Allow asynchronous rebase operations to be monitored
This MR introduces tracking of the `rebase_jid` for merge requests. As
with `merge_ongoing?`, `rebase_in_progress?` will now return true if a
rebase is proceeding in sidekiq.
After one release, we should remove the Gitaly-based lookup of rebases.
It is much better to track this kind of thing via the database.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/api.rb | 5 | ||||
-rw-r--r-- | lib/api/merge_requests.rb | 3 | ||||
-rw-r--r-- | lib/gitlab/import_export/import_export.yml | 1 |
3 files changed, 7 insertions, 2 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb index 20f8c637274..42499c5b41e 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -52,7 +52,10 @@ module API rack_response({ 'message' => '404 Not found' }.to_json, 404) end - rescue_from ::Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError do + rescue_from( + ::ActiveRecord::StaleObjectError, + ::Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError + ) do rack_response({ 'message' => '409 Conflict: Resource lock' }.to_json, 409) end diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 6b8c1a2c0e8..64ee82cd775 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -429,9 +429,10 @@ module API authorize_push_to_merge_request!(merge_request) - RebaseWorker.perform_async(merge_request.id, current_user.id) + merge_request.rebase_async(current_user.id) status :accepted + present rebase_in_progress: merge_request.rebase_in_progress? end desc 'List issues that will be closed on merge' do diff --git a/lib/gitlab/import_export/import_export.yml b/lib/gitlab/import_export/import_export.yml index a0fb051e806..01437c67fa9 100644 --- a/lib/gitlab/import_export/import_export.yml +++ b/lib/gitlab/import_export/import_export.yml @@ -160,6 +160,7 @@ excluded_attributes: - :milestone_id - :ref_fetched - :merge_jid + - :rebase_jid - :latest_merge_request_diff_id award_emoji: - :awardable_id |