Class: Projects::ImportExport::RelationExportWorker
- Inherits:
-
Object
- Object
- Projects::ImportExport::RelationExportWorker
show all
- Includes:
- ApplicationWorker, ExceptionBacktrace, Sidekiq::InterruptionsExhausted
- Defined in:
- app/workers/projects/import_export/relation_export_worker.rb
Constant Summary
collapse
- MAX_INTERRUPTIONS_ERROR_MESSAGE =
'Relation export process reached the maximum number of interruptions'
ApplicationWorker::LOGGING_EXTRA_KEY, ApplicationWorker::SAFE_PUSH_BULK_LIMIT
Gitlab::Loggable::ANONYMOUS
WorkerAttributes::DEFAULT_CONCURRENCY_LIMIT_PERCENTAGE_BY_URGENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY, WorkerAttributes::DEFAULT_DATA_CONSISTENCY_PER_DB, WorkerAttributes::DEFAULT_DEFER_DELAY, WorkerAttributes::LOAD_BALANCED_DATA_CONSISTENCIES, WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_DATA_CONSISTENCIES, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Class Method Summary
collapse
Instance Method Summary
collapse
#build_structured_payload
#job_version
#with_context
Class Method Details
.find_relation_export(project_relation_export_id) ⇒ Object
40
41
42
|
# File 'app/workers/projects/import_export/relation_export_worker.rb', line 40
def self.find_relation_export(project_relation_export_id)
Projects::ImportExport::RelationExport.find_by_id(project_relation_export_id)
end
|
Instance Method Details
#mark_relation_export_failed!(relation_export, message, exception: nil) ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'app/workers/projects/import_export/relation_export_worker.rb', line 62
def mark_relation_export_failed!(relation_export, message, exception: nil)
project_export_job = relation_export.project_export_job
project = project_export_job.project
relation_export.mark_as_failed(message)
log_payload = {
message: 'Project relation export failed',
export_error: message,
relation: relation_export.relation,
project_export_job_id: project_export_job.id,
project_name: project.name,
project_id: project.id
}
Gitlab::ExceptionLogFormatter.format!(exception, log_payload) if exception.present?
Gitlab::Export::Logger.error(log_payload)
end
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'app/workers/projects/import_export/relation_export_worker.rb', line 44
def perform(project_relation_export_id, user_id, params = {})
user = User.find_by_id(user_id)
return unless user
relation_export = self.class.find_relation_export(project_relation_export_id)
return unless relation_export
(:relation, relation_export.relation)
return if user_banned?(user, user_id, relation_export)
relation_export.retry! if relation_export.started?
if relation_export.queued?
Projects::ImportExport::RelationExportService.new(relation_export, user, jid, params.symbolize_keys).execute
end
end
|