Welcome to mirror list, hosted at ThFree Co, Russian Federation.

export_request_worker.rb « bulk_imports « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8bc0acc9b22944e38a8d4f688bbd91238ecd588f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# frozen_string_literal: true

module BulkImports
  class ExportRequestWorker
    include ApplicationWorker

    data_consistency :always

    idempotent!
    worker_has_external_dependencies!
    feature_category :importers

    def perform(entity_id)
      entity = BulkImports::Entity.find(entity_id)

      request_export(entity)
    end

    private

    def request_export(entity)
      http_client(entity.bulk_import.configuration).post(entity.export_relations_url_path)
    end

    def http_client(configuration)
      @client ||= Clients::HTTP.new(
        url: configuration.url,
        token: configuration.access_token
      )
    end
  end
end