Class: RepositoryCleanupWorker

Inherits:
Object
  • Object
show all
Includes:
ApplicationWorker
Defined in:
app/workers/repository_cleanup_worker.rb

Overview

rubocop:disable Scalability/IdempotentWorker

Constant Summary

Constants included from ApplicationWorker

ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT

Constants included from Gitlab::Loggable

Gitlab::Loggable::ANONYMOUS

Constants included from WorkerAttributes

WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES

Instance Method Summary collapse

Methods included from Gitlab::Loggable

#build_structured_payload

Methods included from Gitlab::SidekiqVersioning::Worker

#job_version

Methods included from WorkerContext

#with_context

Instance Method Details

#perform(project_id, user_id) ⇒ Object



19
20
21
22
23
24
25
26
# File 'app/workers/repository_cleanup_worker.rb', line 19

def perform(project_id, user_id)
  project = Project.find(project_id)
  user = User.find(user_id)

  Projects::CleanupService.new(project, user).execute

  notification_service.repository_cleanup_success(project, user)
end

#perform_failure(project_id, user_id, error) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'app/workers/repository_cleanup_worker.rb', line 28

def perform_failure(project_id, user_id, error)
  project = Project.find(project_id)
  user = User.find(user_id)

  # Ensure the file is removed and the repository is made read-write again
  Projects::CleanupService.cleanup_after(project)

  notification_service.repository_cleanup_failure(project, user, error)
end