Class: Gitlab::Ci::Tags::BulkInsert

Inherits:
Object
  • Object
show all
Includes:
Utils::StrongMemoize
Defined in:
lib/gitlab/ci/tags/bulk_insert.rb

Constant Summary collapse

TAGGINGS_BATCH_SIZE =
1000
TAGS_BATCH_SIZE =
500

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Constructor Details

#initialize(taggables) ⇒ BulkInsert

Returns a new instance of BulkInsert.


16
17
18
# File 'lib/gitlab/ci/tags/bulk_insert.rb', line 16

def initialize(taggables)
  @taggables = taggables
end

Class Method Details

.bulk_insert_tags!(taggables) ⇒ Object


12
13
14
# File 'lib/gitlab/ci/tags/bulk_insert.rb', line 12

def self.bulk_insert_tags!(taggables)
  Gitlab::Ci::Tags::BulkInsert.new(taggables).insert!
end

Instance Method Details

#insert!Object


20
21
22
23
24
# File 'lib/gitlab/ci/tags/bulk_insert.rb', line 20

def insert!
  return false if tag_list_by_taggable.empty?

  persist_build_tags!
end