summaryrefslogtreecommitdiff
path: root/app/workers/concerns/gitlab/github_import/queue.rb
blob: 05eb7fbc2cb93d5de9aa46cafe71571c72537aef (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 Gitlab
  module GithubImport
    module Queue
      extend ActiveSupport::Concern

      included do
        queue_namespace :github_importer
        feature_category :importers

        # If a job produces an error it may block a stage from advancing
        # forever. To prevent this from happening we prevent jobs from going to
        # the dead queue. This does mean some resources may not be imported, but
        # this is better than a project being stuck in the "import" state
        # forever.
        sidekiq_options dead: false, retry: 5

        sidekiq_retries_exhausted do |msg, e|
          Gitlab::Import::Logger.error(
            event: :github_importer_exhausted,
            message: msg['error_message'],
            class: msg['class'],
            args: msg['args'],
            exception_message: e.message,
            exception_backtrace: e.backtrace
          )
        end
      end
    end
  end
end