Reduce delay in destroying a project from 1-minute to immediately
Run ProjectDestroyWorker after pending_delete attribute has been committed to DB
This commit is contained in:
parent
2e1162272e
commit
a65de9c2c1
3 changed files with 9 additions and 3 deletions
|
@ -6,6 +6,7 @@ v 8.8.0 (unreleased)
|
||||||
- Log to application.log when an admin starts and stops impersonating a user
|
- Log to application.log when an admin starts and stops impersonating a user
|
||||||
- Updated gitlab_git to 10.1.0
|
- Updated gitlab_git to 10.1.0
|
||||||
- GitAccess#protected_tag? no longer loads all tags just to check if a single one exists
|
- GitAccess#protected_tag? no longer loads all tags just to check if a single one exists
|
||||||
|
- Reduce delay in destroying a project from 1-minute to immediately
|
||||||
- Make build status canceled if any of the jobs was canceled and none failed
|
- Make build status canceled if any of the jobs was canceled and none failed
|
||||||
- Upgrade Sidekiq to 4.1.2
|
- Upgrade Sidekiq to 4.1.2
|
||||||
- Sanitize repo paths in new project error message
|
- Sanitize repo paths in new project error message
|
||||||
|
|
|
@ -1039,4 +1039,11 @@ class Project < ActiveRecord::Base
|
||||||
def wiki
|
def wiki
|
||||||
@wiki ||= ProjectWiki.new(self, self.owner)
|
@wiki ||= ProjectWiki.new(self, self.owner)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def schedule_delete!(user_id, params)
|
||||||
|
# Queue this task for after the commit, so once we mark pending_delete it will run
|
||||||
|
run_after_commit { ProjectDestroyWorker.perform_async(id, user_id, params) }
|
||||||
|
|
||||||
|
update_attribute(:pending_delete, true)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,9 +7,7 @@ module Projects
|
||||||
DELETED_FLAG = '+deleted'
|
DELETED_FLAG = '+deleted'
|
||||||
|
|
||||||
def pending_delete!
|
def pending_delete!
|
||||||
project.update_attribute(:pending_delete, true)
|
project.schedule_delete!(current_user.id, params)
|
||||||
|
|
||||||
ProjectDestroyWorker.perform_in(1.minute, project.id, current_user.id, params)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
|
|
Loading…
Reference in a new issue