Commit 33795139 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent c7e385e2
......@@ -110,14 +110,6 @@ export default {
board.name.toLowerCase().includes(this.filterTerm.toLowerCase()),
);
},
reload: {
get() {
return this.state.reload;
},
set(newValue) {
this.state.reload = newValue;
},
},
board() {
return this.state.currentBoard;
},
......@@ -142,16 +134,6 @@ export default {
this.scrollFadeInitialized = false;
this.$nextTick(this.setScrollFade);
},
reload() {
if (this.reload) {
this.boards = [];
this.recentBoards = [];
this.loading = true;
this.reload = false;
this.loadBoards(false);
}
},
},
created() {
boardsStore.setCurrentBoard(this.currentBoard);
......
......@@ -30,7 +30,6 @@ const boardsStore = {
labels: [],
},
currentPage: '',
reload: false,
endpoints: {},
},
detail: {
......@@ -61,7 +60,6 @@ const boardsStore = {
};
},
showPage(page) {
this.state.reload = false;
this.state.currentPage = page;
},
addList(listObj, defaultAvatar) {
......
......@@ -371,8 +371,11 @@
}
.btn-loading {
&:not(.disabled) .fa {
display: none;
&:not(.disabled) {
.fa,
.spinner {
display: none;
}
}
.fa {
......
# frozen_string_literal: true
module MilestoneEventable
extend ActiveSupport::Concern
included do
has_many :resource_milestone_events
end
end
# frozen_string_literal: true
module ResourceEventTools
extend ActiveSupport::Concern
included do
belongs_to :user
validates :user, presence: { unless: :importing? }, on: :create
validate :exactly_one_issuable
scope :created_after, ->(time) { where('created_at > ?', time) }
end
def exactly_one_issuable
issuable_count = self.class.issuable_attrs.count { |attr| self["#{attr}_id"] }
return true if issuable_count == 1
# if none of issuable IDs is set, check explicitly if nested issuable
# object is set, this is used during project import
if issuable_count == 0 && importing?
issuable_count = self.class.issuable_attrs.count { |attr| self.public_send(attr) } # rubocop:disable GitlabSecurity/PublicSend
return true if issuable_count == 1
end
errors.add(:base, "Exactly one of #{self.class.issuable_attrs.join(', ')} is required")
end
end
......@@ -15,6 +15,7 @@ class Issue < ApplicationRecord
include ThrottledTouch
include LabelEventable
include IgnorableColumns
include MilestoneEventable
DueDateStruct = Struct.new(:title, :name).freeze
NoDueDate = DueDateStruct.new('No Due Date', '0').freeze
......
......@@ -18,6 +18,7 @@ class MergeRequest < ApplicationRecord
include DeprecatedAssignee
include ShaAttribute
include IgnorableColumns
include MilestoneEventable
sha_attribute :squash_commit_sha
......
# frozen_string_literal: true
class MilestoneNote < ::Note
attr_accessor :resource_parent, :event, :milestone
def self.from_event(event, resource: nil, resource_parent: nil)
resource ||= event.resource
attrs = {
system: true,
author: event.user,
created_at: event.created_at,
noteable: resource,
milestone: event.milestone,
event: event,
system_note_metadata: ::SystemNoteMetadata.new(action: 'milestone'),
resource_parent: resource_parent
}
if resource_parent.is_a?(Project)
attrs[:project_id] = resource_parent.id
end
MilestoneNote.new(attrs)
end
def note
@note ||= note_text
end
def note_html
@note_html ||= Banzai::Renderer.cacheless_render_field(self, :note, { group: group, project: project })
end
def project
resource_parent if resource_parent.is_a?(Project)
end
def group
resource_parent if resource_parent.is_a?(Group)
end
private
def note_text(html: false)
format = milestone&.group_milestone? ? :name : :iid
milestone.nil? ? 'removed milestone' : "changed milestone to #{milestone.to_reference(project, format: format)}"
end
end
......@@ -4,20 +4,17 @@ class ResourceLabelEvent < ApplicationRecord
include Importable
include Gitlab::Utils::StrongMemoize
include CacheMarkdownField
include ResourceEventTools
cache_markdown_field :reference
belongs_to :user
belongs_to :issue
belongs_to :merge_request
belongs_to :label
scope :created_after, ->(time) { where('created_at > ?', time) }
scope :inc_relations, -> { includes(:label, :user) }
validates :user, presence: { unless: :importing? }, on: :create
validates :label, presence: { unless: :importing? }, on: :create
validate :exactly_one_issuable
after_save :expire_etag_cache
after_destroy :expire_etag_cache
......@@ -94,22 +91,6 @@ class ResourceLabelEvent < ApplicationRecord
end
end
def exactly_one_issuable
issuable_count = self.class.issuable_attrs.count { |attr| self["#{attr}_id"] }
return true if issuable_count == 1
# if none of issuable IDs is set, check explicitly if nested issuable
# object is set, this is used during project import
if issuable_count == 0 && importing?
issuable_count = self.class.issuable_attrs.count { |attr| self.public_send(attr) } # rubocop:disable GitlabSecurity/PublicSend
return true if issuable_count == 1
end
errors.add(:base, "Exactly one of #{self.class.issuable_attrs.join(', ')} is required")
end
def expire_etag_cache
issuable.expire_note_etag_cache
end
......
# frozen_string_literal: true
class ResourceMilestoneEvent < ApplicationRecord
include Gitlab::Utils::StrongMemoize
include Importable
include ResourceEventTools
belongs_to :issue
belongs_to :merge_request
belongs_to :milestone
scope :by_issue, ->(issue) { where(issue_id: issue.id) }
scope :by_merge_request, ->(merge_request) { where(merge_request_id: merge_request.id) }
enum action: {
add: 1,
remove: 2
}
# state is used for issue and merge request states.
enum state: Issue.available_states.merge(MergeRequest.available_states)
def self.issuable_attrs
%i(issue merge_request).freeze
end
def resource
issue || merge_request
end
end
......@@ -19,6 +19,7 @@ module Issuable
copy_resource_label_events
copy_resource_weight_events
copy_resource_milestone_events
end
private
......@@ -65,6 +66,23 @@ module Issuable
end
end
def copy_resource_milestone_events
entity_key = new_entity.class.name.underscore.foreign_key
copy_events(ResourceMilestoneEvent.table_name, original_entity.resource_milestone_events) do |event|
matching_destination_milestone = matching_milestone(event.milestone.title)
if matching_destination_milestone.present?
event.attributes
.except('id', 'reference', 'reference_html')
.merge(entity_key => new_entity.id,
'milestone_id' => matching_destination_milestone.id,
'action' => ResourceMilestoneEvent.actions[event.action],
'state' => ResourceMilestoneEvent.states[event.state])
end
end
end
def copy_events(table_name, events_to_copy)
events_to_copy.find_in_batches do |batch|
events = batch.map do |event|
......
......@@ -22,13 +22,17 @@ module Issuable
end
create_due_date_note if issuable.previous_changes.include?('due_date')
create_milestone_note if issuable.previous_changes.include?('milestone_id')
create_milestone_note if has_milestone_changes?
create_labels_note(old_labels) if old_labels && issuable.labels != old_labels
end
end
private
def has_milestone_changes?
issuable.previous_changes.include?('milestone_id')
end
def handle_time_tracking_note
if issuable.previous_changes.include?('time_estimate')
create_time_estimate_note
......@@ -95,7 +99,16 @@ module Issuable
end
def create_milestone_note
SystemNoteService.change_milestone(issuable, issuable.project, current_user, issuable.milestone)
if milestone_changes_tracking_enabled?
# Creates a synthetic note
ResourceEvents::ChangeMilestoneService.new(resource: issuable, user: current_user).execute
else
SystemNoteService.change_milestone(issuable, issuable.project, current_user, issuable.milestone)
end
end
def milestone_changes_tracking_enabled?
::Feature.enabled?(:track_resource_milestone_change_events, issuable.project)
end
def create_due_date_note
......
# frozen_string_literal: true
module ResourceEvents
class ChangeMilestoneService
attr_reader :resource, :user, :event_created_at, :resource_args
def initialize(resource:, user:, created_at: Time.now)
@resource = resource
@user = user
@event_created_at = created_at
@resource_args = {
user_id: user.id,
created_at: event_created_at
}
end
def execute
args = build_resource_args
action = if milestone.nil?
:remove
else
:add
end
record = args.merge(milestone_id: milestone&.id, action: ResourceMilestoneEvent.actions[action])
create_event(record)
end
private
def milestone
resource&.milestone
end
def create_event(record)
ResourceMilestoneEvent.create(record)
resource.expire_note_etag_cache
end
def build_resource_args
key = resource.class.name.underscore.foreign_key
resource_args.merge(key => resource.id, state: ResourceMilestoneEvent.states[resource.state])
end
end
end
......@@ -9,6 +9,11 @@ module ResourceEvents
class MergeIntoNotesService
include Gitlab::Utils::StrongMemoize
SYNTHETIC_NOTE_BUILDER_SERVICES = [
SyntheticLabelNotesBuilderService,
SyntheticMilestoneNotesBuilderService
].freeze
attr_reader :resource, :current_user, :params
def initialize(resource, current_user, params = {})
......@@ -24,7 +29,9 @@ module ResourceEvents
private
def synthetic_notes
SyntheticLabelNotesBuilderService.new(resource, current_user, params).execute
SYNTHETIC_NOTE_BUILDER_SERVICES.flat_map do |service|
service.new(resource, current_user, params).execute
end
end
end
end
......
# frozen_string_literal: true
# We store events about resource milestone changes in a separate table,
# but we still want to display notes about milestone changes
# as classic system notes in UI. This service generates "synthetic" notes for
# milestone event changes.
module ResourceEvents
class SyntheticMilestoneNotesBuilderService < BaseSyntheticNotesBuilderService
private
def synthetic_notes
return [] unless tracking_enabled?
milestone_change_events.map do |event|
MilestoneNote.from_event(event, resource: resource, resource_parent: resource_parent)
end
end
def milestone_change_events
return [] unless resource.respond_to?(:resource_milestone_events)
events = resource.resource_milestone_events.includes(user: :status) # rubocop: disable CodeReuse/ActiveRecord
since_fetch_at(events)
end
def tracking_enabled?
::Feature.enabled?(:track_resource_milestone_change_events, resource.project)
end
end
end
......@@ -48,14 +48,14 @@
- if todo.pending?
.todo-actions
= link_to dashboard_todo_path(todo), method: :delete, class: 'btn btn-loading js-done-todo', data: { href: dashboard_todo_path(todo) } do
= link_to dashboard_todo_path(todo), method: :delete, class: 'btn btn-loading d-flex align-items-center js-done-todo', data: { href: dashboard_todo_path(todo) } do
Done
= icon('spinner spin')
= link_to restore_dashboard_todo_path(todo), method: :patch, class: 'btn btn-loading js-undo-todo hidden', data: { href: restore_dashboard_todo_path(todo) } do
%span.spinner.ml-1
= link_to restore_dashboard_todo_path(todo), method: :patch, class: 'btn btn-loading d-flex align-items-center js-undo-todo hidden', data: { href: restore_dashboard_todo_path(todo) } do
Undo
= icon('spinner spin')
%span.spinner.ml-1
- else
.todo-actions
= link_to restore_dashboard_todo_path(todo), method: :patch, class: 'btn btn-loading js-add-todo', data: { href: restore_dashboard_todo_path(todo) } do
= link_to restore_dashboard_todo_path(todo), method: :patch, class: 'btn btn-loading d-flex align-items-center js-add-todo', data: { href: restore_dashboard_todo_path(todo) } do
Add a To Do
= icon('spinner spin')
%span.spinner.ml-1
......@@ -26,12 +26,12 @@
.nav-controls
- if @todos.any?(&:pending?)
.append-right-default
= link_to destroy_all_dashboard_todos_path(todos_filter_params), class: 'btn btn-loading js-todos-mark-all', method: :delete, data: { href: destroy_all_dashboard_todos_path(todos_filter_params) } do
= link_to destroy_all_dashboard_todos_path(todos_filter_params), class: 'btn btn-loading d-flex align-items-center js-todos-mark-all', method: :delete, data: { href: destroy_all_dashboard_todos_path(todos_filter_params) } do
Mark all as done
= icon('spinner spin')
= link_to bulk_restore_dashboard_todos_path, class: 'btn btn-loading js-todos-undo-all hidden', method: :patch , data: { href: bulk_restore_dashboard_todos_path(todos_filter_params) } do
%span.spinner.ml-1
= link_to bulk_restore_dashboard_todos_path, class: 'btn btn-loading d-flex align-items-center js-todos-undo-all hidden', method: :patch , data: { href: bulk_restore_dashboard_todos_path(todos_filter_params) } do
Undo mark all as done
= icon('spinner spin')
%span.spinner.ml-1
.todos-filters
.issues-details-filters.row-content-block.second-block
......
# frozen_string_literal: true
class AdminEmailWorker
class AdminEmailWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext
# This worker does not perform work scoped to a context
......
......@@ -9,1077 +9,1257 @@
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: auto_merge:auto_merge_process
:feature_category: :continuous_delivery
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 3
:idempotent:
- :name: chaos:chaos_cpu_spin
:feature_category: :chaos_engineering
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: chaos:chaos_db_spin
:feature_category: :chaos_engineering
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: chaos:chaos_kill
:feature_category: :chaos_engineering
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: chaos:chaos_leak_mem
:feature_category: :chaos_engineering
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: chaos:chaos_sleep
:feature_category: :chaos_engineering
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: container_repository:cleanup_container_repository
:feature_category: :container_registry
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: container_repository:delete_container_repository
:feature_category: :container_registry
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:admin_email
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:ci_archive_traces_cron
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:container_expiration_policy
:feature_category: :container_registry
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:environments_auto_stop_cron
:feature_category: :continuous_delivery
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:expire_build_artifacts
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:gitlab_usage_ping
:feature_category: :collection
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:import_export_project_cleanup
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:issue_due_scheduler
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:namespaces_prune_aggregation_schedules
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
:idempotent:
- :name: cronjob:pages_domain_removal_cron
:feature_category: :pages
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
:idempotent:
- :name: cronjob:pages_domain_ssl_renewal_cron
:feature_category: :pages
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:pages_domain_verification_cron
:feature_category: :pages
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:personal_access_tokens_expiring
:feature_category: :authentication_and_authorization
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:pipeline_schedule
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
:idempotent:
- :name: cronjob:prune_old_events
:feature_category: :users
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:prune_web_hook_logs
:feature_category: :integrations
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:remove_expired_group_links
:feature_category: :authentication_and_authorization
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:remove_expired_members
:feature_category: :authentication_and_authorization
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
:idempotent:
- :name: cronjob:remove_unreferenced_lfs_objects
:feature_category: :git_lfs
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:repository_archive_cache
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:repository_check_dispatch
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:requests_profiles
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:schedule_migrate_external_diffs
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:stuck_ci_jobs
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
:idempotent:
- :name: cronjob:stuck_import_jobs
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
:idempotent:
- :name: cronjob:stuck_merge_jobs
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: cronjob:trending_projects
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: deployment:deployments_finished
:feature_category: :continuous_delivery
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 3
:idempotent:
- :name: deployment:deployments_forward_deployment
:feature_category: :continuous_delivery
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 3
:idempotent:
- :name: deployment:deployments_success
:feature_category: :continuous_delivery
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 3
:idempotent:
- :name: gcp_cluster:cluster_configure
:feature_category: :kubernetes_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:cluster_configure_istio
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:cluster_install_app
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:cluster_patch_app
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:cluster_project_configure
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:cluster_provision
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:cluster_upgrade_app
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:cluster_wait_for_app_installation
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
:idempotent:
- :name: gcp_cluster:cluster_wait_for_ingress_ip_address
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:clusters_applications_activate_service
:feature_category: :kubernetes_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:clusters_applications_deactivate_service
:feature_category: :kubernetes_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:clusters_applications_uninstall
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:clusters_applications_wait_for_uninstall_app
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
:idempotent:
- :name: gcp_cluster:clusters_cleanup_app
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:clusters_cleanup_project_namespace
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:clusters_cleanup_service_account
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gcp_cluster:wait_for_cluster_creation
:feature_category: :kubernetes_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_importer:github_import_import_diff_note
:feature_category: :importers
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_importer:github_import_import_issue
:feature_category: :importers
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_importer:github_import_import_lfs_object
:feature_category: :importers
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_importer:github_import_import_note
:feature_category: :importers
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_importer:github_import_import_pull_request
:feature_category: :importers
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_importer:github_import_refresh_import_jid
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_importer:github_import_stage_finish_import
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_importer:github_import_stage_import_base_data
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_importer:github_import_stage_import_issues_and_diff_notes
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_importer:github_import_stage_import_lfs_objects
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_importer:github_import_stage_import_notes
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_importer:github_import_stage_import_pull_requests
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_importer:github_import_stage_import_repository
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: hashed_storage:hashed_storage_migrator
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: hashed_storage:hashed_storage_project_migrate
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: hashed_storage:hashed_storage_project_rollback
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: hashed_storage:hashed_storage_rollbacker
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: incident_management:incident_management_process_alert
:feature_category: :incident_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: mail_scheduler:mail_scheduler_issue_due
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: mail_scheduler:mail_scheduler_notification_service
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 2
:idempotent:
- :name: notifications:new_release
:feature_category: :release_orchestration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: object_pool:object_pool_create
:feature_category: :gitaly
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: object_pool:object_pool_destroy
:feature_category: :gitaly
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: object_pool:object_pool_join
:feature_category: :gitaly
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 1
:idempotent:
- :name: object_pool:object_pool_schedule_join
:feature_category: :gitaly
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: object_storage:object_storage_background_move
:feature_category: :not_owned
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: object_storage:object_storage_migrate_uploads
:feature_category: :not_owned
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: pipeline_background:archive_trace
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: pipeline_background:ci_build_trace_chunk_flush
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: pipeline_cache:expire_job_cache
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 3
:idempotent: true
- :name: pipeline_cache:expire_pipeline_cache
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 3
:idempotent:
- :name: pipeline_creation:create_pipeline
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 4
:idempotent:
- :name: pipeline_creation:run_pipeline_schedule
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 4
:idempotent:
- :name: pipeline_default:build_coverage
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 3
:idempotent:
- :name: pipeline_default:build_trace_sections
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 3
:idempotent:
- :name: pipeline_default:ci_create_cross_project_pipeline
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 3
:idempotent:
- :name: pipeline_default:ci_pipeline_bridge_status
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 3
:idempotent:
- :name: pipeline_default:pipeline_metrics
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 3
:idempotent:
- :name: pipeline_default:pipeline_notification
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 3
:idempotent:
- :name: pipeline_hooks:build_hooks
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: pipeline_hooks:pipeline_hooks
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 2
:idempotent:
- :name: pipeline_processing:build_finished
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 5
:idempotent:
- :name: pipeline_processing:build_queue
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 5
:idempotent:
- :name: pipeline_processing:build_success
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 5
:idempotent:
- :name: pipeline_processing:ci_build_prepare
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 5
:idempotent:
- :name: pipeline_processing:ci_build_schedule
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 5
:idempotent:
- :name: pipeline_processing:ci_resource_groups_assign_resource_from_resource_group
:feature_category: :continuous_delivery
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 5
:idempotent:
- :name: pipeline_processing:pipeline_process
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 5
:idempotent:
- :name: pipeline_processing:pipeline_success
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 5
:idempotent:
- :name: pipeline_processing:pipeline_update
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 5
:idempotent:
- :name: pipeline_processing:stage_update
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 5
:idempotent:
- :name: pipeline_processing:update_head_pipeline_for_merge_request
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 5
:idempotent:
- :name: repository_check:repository_check_batch
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: repository_check:repository_check_clear
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: repository_check:repository_check_single_repository
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: todos_destroyer:todos_destroyer_confidential_issue
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: todos_destroyer:todos_destroyer_entity_leave
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: todos_destroyer:todos_destroyer_group_private
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: todos_destroyer:todos_destroyer_private_features
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: todos_destroyer:todos_destroyer_project_private
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: update_namespace_statistics:namespaces_root_statistics
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: update_namespace_statistics:namespaces_schedule_aggregation
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: authorized_projects
:feature_category: :authentication_and_authorization
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: background_migration
:feature_category: :not_owned
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: chat_notification
:feature_category: :chatops
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: create_commit_signature
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: create_evidence
:feature_category: :release_governance
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: create_note_diff_file
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: default
:feature_category:
:has_external_dependencies:
:latency_sensitive:
:resource_boundary:
:weight: 1
:idempotent:
- :name: delete_diff_files
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: delete_merged_branches
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: delete_stored_files
:feature_category: :not_owned
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: delete_user
:feature_category: :authentication_and_authorization
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: detect_repository_languages
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: email_receiver
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: emails_on_push
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 2
:idempotent:
- :name: error_tracking_issue_link
:feature_category: :error_tracking
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: expire_build_instance_artifacts
:feature_category: :continuous_integration
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: file_hook
:feature_category: :integrations
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: git_garbage_collect
:feature_category: :gitaly
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: github_import_advance_stage
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: gitlab_shell
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: group_destroy
:feature_category: :subgroups
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: group_export
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: group_import
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: import_issues_csv
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :cpu
:weight: 2
:idempotent:
- :name: invalid_gpg_signature_update
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: irker
:feature_category: :integrations
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: mailers
:feature_category:
:has_external_dependencies:
:latency_sensitive:
:resource_boundary:
:weight: 2
:idempotent:
- :name: merge
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 5
:idempotent:
- :name: merge_request_mergeability_check
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: migrate_external_diffs
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: namespaceless_project_destroy
:feature_category: :authentication_and_authorization
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: new_issue
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 2
:idempotent:
- :name: new_merge_request
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 2
:idempotent:
- :name: new_note
:feature_category: :issue_tracking
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 2
:idempotent:
- :name: pages
:feature_category: :pages
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: pages_domain_ssl_renewal
:feature_category: :pages
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: pages_domain_verification
:feature_category: :pages
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: phabricator_import_import_tasks
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: post_receive
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 5
:idempotent:
- :name: process_commit
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 3
:idempotent:
- :name: project_cache
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: project_daily_statistics
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: project_destroy
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: project_export
:feature_category: :importers
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :memory
:weight: 1
:idempotent:
- :name: project_service
:feature_category: :integrations
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: propagate_service_template
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: reactive_caching
:feature_category: :not_owned
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 1
:idempotent:
- :name: rebase
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: remote_mirror_notification
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: repository_cleanup
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: repository_fork
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: repository_import
:feature_category: :importers
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: repository_remove_remote
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: repository_update_remote_mirror
:feature_category: :source_code_management
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: self_monitoring_project_create
:feature_category: :metrics
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: self_monitoring_project_delete
:feature_category: :metrics
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 2
:idempotent:
- :name: system_hook_push
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: update_external_pull_requests
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 3
:idempotent:
- :name: update_merge_requests
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive: true
:resource_boundary: :cpu
:weight: 3
:idempotent:
- :name: update_project_statistics
:feature_category: :source_code_management
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: upload_checksum
:feature_category: :geo_replication
:has_external_dependencies:
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
- :name: web_hook
:feature_category: :integrations
:has_external_dependencies: true
:latency_sensitive:
:resource_boundary: :unknown
:weight: 1
:idempotent:
# frozen_string_literal: true
class ArchiveTraceWorker
class ArchiveTraceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineBackgroundQueue
......
# frozen_string_literal: true
class AuthorizedProjectsWorker
class AuthorizedProjectsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
prepend WaitableWorker
......
# frozen_string_literal: true
module AutoDevops
class DisableWorker
class DisableWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include AutoDevopsQueue
......
# frozen_string_literal: true
class AutoMergeProcessWorker
class AutoMergeProcessWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :auto_merge
......
# frozen_string_literal: true
class BackgroundMigrationWorker
class BackgroundMigrationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category_not_owned!
......@@ -22,17 +22,19 @@ class BackgroundMigrationWorker
# class_name - The class name of the background migration to run.
# arguments - The arguments to pass to the migration class.
def perform(class_name, arguments = [])
should_perform, ttl = perform_and_ttl(class_name)
with_context(caller_id: class_name.to_s) do
should_perform, ttl = perform_and_ttl(class_name)
if should_perform
Gitlab::BackgroundMigration.perform(class_name, arguments)
else
# If the lease could not be obtained this means either another process is
# running a migration of this class or we ran one recently. In this case
# we'll reschedule the job in such a way that it is picked up again around
# the time the lease expires.
self.class
.perform_in(ttl || self.class.minimum_interval, class_name, arguments)
if should_perform
Gitlab::BackgroundMigration.perform(class_name, arguments)
else
# If the lease could not be obtained this means either another process is
# running a migration of this class or we ran one recently. In this case
# we'll reschedule the job in such a way that it is picked up again around
# the time the lease expires.
self.class
.perform_in(ttl || self.class.minimum_interval, class_name, arguments)
end
end
end
......
# frozen_string_literal: true
class BuildCoverageWorker
class BuildCoverageWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class BuildFinishedWorker
class BuildFinishedWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class BuildHooksWorker
class BuildHooksWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class BuildQueueWorker
class BuildQueueWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class BuildSuccessWorker
class BuildSuccessWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class BuildTraceSectionsWorker
class BuildTraceSectionsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
module Chaos
class CpuSpinWorker
class CpuSpinWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ChaosQueue
......
# frozen_string_literal: true
module Chaos
class DbSpinWorker
class DbSpinWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ChaosQueue
......
# frozen_string_literal: true
module Chaos
class KillWorker
class KillWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ChaosQueue
......
# frozen_string_literal: true
module Chaos
class LeakMemWorker
class LeakMemWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ChaosQueue
......
# frozen_string_literal: true
module Chaos
class SleepWorker
class SleepWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ChaosQueue
......
# frozen_string_literal: true
class ChatNotificationWorker
class ChatNotificationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
TimeoutExceeded = Class.new(StandardError)
......
# frozen_string_literal: true
module Ci
class ArchiveTracesCronWorker
class ArchiveTracesCronWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
......
# frozen_string_literal: true
module Ci
class BuildPrepareWorker
class BuildPrepareWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
module Ci
class BuildScheduleWorker
class BuildScheduleWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
module Ci
class BuildTraceChunkFlushWorker
class BuildTraceChunkFlushWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineBackgroundQueue
......
# frozen_string_literal: true
module Ci
class CreateCrossProjectPipelineWorker
class CreateCrossProjectPipelineWorker # rubocop:disable Scalability/IdempotentWorker
include ::ApplicationWorker
include ::PipelineQueue
......
# frozen_string_literal: true
module Ci
class PipelineBridgeStatusWorker
class PipelineBridgeStatusWorker # rubocop:disable Scalability/IdempotentWorker
include ::ApplicationWorker
include ::PipelineQueue
......
......@@ -2,7 +2,7 @@
module Ci
module ResourceGroups
class AssignResourceFromResourceGroupWorker
class AssignResourceFromResourceGroupWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class CleanupContainerRepositoryWorker
class CleanupContainerRepositoryWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :container_repository
......
# frozen_string_literal: true
class ClusterConfigureIstioWorker
class ClusterConfigureIstioWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
......
# frozen_string_literal: true
class ClusterConfigureWorker
class ClusterConfigureWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
......
# frozen_string_literal: true
class ClusterInstallAppWorker
class ClusterInstallAppWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications
......
# frozen_string_literal: true
class ClusterPatchAppWorker
class ClusterPatchAppWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications
......
# frozen_string_literal: true
class ClusterProjectConfigureWorker
class ClusterProjectConfigureWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
......
# frozen_string_literal: true
class ClusterProvisionWorker
class ClusterProvisionWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
......
# frozen_string_literal: true
class ClusterUpgradeAppWorker
class ClusterUpgradeAppWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications
......
# frozen_string_literal: true
class ClusterWaitForAppInstallationWorker
class ClusterWaitForAppInstallationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications
......
# frozen_string_literal: true
class ClusterWaitForIngressIpAddressWorker
class ClusterWaitForIngressIpAddressWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications
......
......@@ -2,7 +2,7 @@
module Clusters
module Applications
class ActivateServiceWorker
class ActivateServiceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
......
......@@ -2,7 +2,7 @@
module Clusters
module Applications
class DeactivateServiceWorker
class DeactivateServiceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
......
......@@ -2,7 +2,7 @@
module Clusters
module Applications
class UninstallWorker
class UninstallWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications
......
......@@ -2,7 +2,7 @@
module Clusters
module Applications
class WaitForUninstallAppWorker
class WaitForUninstallAppWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications
......
......@@ -2,7 +2,7 @@
module Clusters
module Cleanup
class AppWorker
class AppWorker # rubocop:disable Scalability/IdempotentWorker
include ClusterCleanupMethods
def perform(cluster_id, execution_count = 0)
......
......@@ -2,7 +2,7 @@
module Clusters
module Cleanup
class ProjectNamespaceWorker
class ProjectNamespaceWorker # rubocop:disable Scalability/IdempotentWorker
include ClusterCleanupMethods
def perform(cluster_id, execution_count = 0)
......
......@@ -2,7 +2,7 @@
module Clusters
module Cleanup
class ServiceAccountWorker
class ServiceAccountWorker # rubocop:disable Scalability/IdempotentWorker
include ClusterCleanupMethods
def perform(cluster_id)
......
......@@ -89,6 +89,14 @@ module WorkerAttributes
worker_attributes[:resource_boundary] || :unknown
end
def idempotent!
worker_attributes[:idempotent] = true
end
def idempotent?
worker_attributes[:idempotent]
end
def weight(value)
worker_attributes[:weight] = value
end
......
# frozen_string_literal: true
class ContainerExpirationPolicyWorker
class ContainerExpirationPolicyWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue
......
# frozen_string_literal: true
class CreateCommitSignatureWorker
class CreateCommitSignatureWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
class CreateEvidenceWorker
class CreateEvidenceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :release_governance
......
# frozen_string_literal: true
class CreateNoteDiffFileWorker
class CreateNoteDiffFileWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
class CreatePipelineWorker
class CreatePipelineWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class DeleteContainerRepositoryWorker
class DeleteContainerRepositoryWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExclusiveLeaseGuard
......
# frozen_string_literal: true
class DeleteDiffFilesWorker
class DeleteDiffFilesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
class DeleteMergedBranchesWorker
class DeleteMergedBranchesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
class DeleteStoredFilesWorker
class DeleteStoredFilesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category_not_owned!
......
# frozen_string_literal: true
class DeleteUserWorker
class DeleteUserWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :authentication_and_authorization
......
# frozen_string_literal: true
module Deployments
class FinishedWorker
class FinishedWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :deployment
......
# frozen_string_literal: true
module Deployments
class ForwardDeploymentWorker
class ForwardDeploymentWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :deployment
......
# frozen_string_literal: true
module Deployments
class SuccessWorker
class SuccessWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :deployment
......
# frozen_string_literal: true
class DetectRepositoryLanguagesWorker
class DetectRepositoryLanguagesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExceptionBacktrace
include ExclusiveLeaseGuard
......
# frozen_string_literal: true
class EmailReceiverWorker
class EmailReceiverWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :issue_tracking
......
# frozen_string_literal: true
class EmailsOnPushWorker
class EmailsOnPushWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
attr_reader :email, :skip_premailer
......
# frozen_string_literal: true
module Environments
class AutoStopCronWorker
class AutoStopCronWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
......
......@@ -5,7 +5,7 @@
# If a link to a different GitLab issue exists, a new link
# will still be created, but will not be visible in Sentry
# until the prior link is deleted.
class ErrorTrackingIssueLinkWorker
class ErrorTrackingIssueLinkWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExclusiveLeaseGuard
include Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true
class ExpireBuildArtifactsWorker
class ExpireBuildArtifactsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext
# This worker does not perform work scoped to a context
......
# frozen_string_literal: true
class ExpireBuildInstanceArtifactsWorker
class ExpireBuildInstanceArtifactsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :continuous_integration
......
......@@ -6,6 +6,7 @@ class ExpireJobCacheWorker
queue_namespace :pipeline_cache
latency_sensitive_worker!
idempotent!
# rubocop: disable CodeReuse/ActiveRecord
def perform(job_id)
......
# frozen_string_literal: true
class ExpirePipelineCacheWorker
class ExpirePipelineCacheWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class FileHookWorker
class FileHookWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
sidekiq_options retry: false
......
# frozen_string_literal: true
class GitGarbageCollectWorker
class GitGarbageCollectWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
sidekiq_options retry: false
......
......@@ -6,7 +6,7 @@ module Gitlab
# number of jobs to complete, without blocking a thread. Once all jobs have
# been completed this worker will advance the import process to the next
# stage.
class AdvanceStageWorker
class AdvanceStageWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
sidekiq_options dead: false
......
......@@ -2,7 +2,7 @@
module Gitlab
module GithubImport
class ImportDiffNoteWorker
class ImportDiffNoteWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter
def representation_class
......
......@@ -2,7 +2,7 @@
module Gitlab
module GithubImport
class ImportIssueWorker
class ImportIssueWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter
def representation_class
......
......@@ -2,7 +2,7 @@
module Gitlab
module GithubImport
class ImportLfsObjectWorker
class ImportLfsObjectWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter
def representation_class
......
......@@ -2,7 +2,7 @@
module Gitlab
module GithubImport
class ImportNoteWorker
class ImportNoteWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter
def representation_class
......
......@@ -2,7 +2,7 @@
module Gitlab
module GithubImport
class ImportPullRequestWorker
class ImportPullRequestWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter
def representation_class
......
......@@ -2,7 +2,7 @@
module Gitlab
module GithubImport
class RefreshImportJidWorker
class RefreshImportJidWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include GithubImport::Queue
......
......@@ -3,7 +3,7 @@
module Gitlab
module GithubImport
module Stage
class FinishImportWorker
class FinishImportWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include GithubImport::Queue
include StageMethods
......
......@@ -3,7 +3,7 @@
module Gitlab
module GithubImport
module Stage
class ImportBaseDataWorker
class ImportBaseDataWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include GithubImport::Queue
include StageMethods
......
......@@ -3,7 +3,7 @@
module Gitlab
module GithubImport
module Stage
class ImportIssuesAndDiffNotesWorker
class ImportIssuesAndDiffNotesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include GithubImport::Queue
include StageMethods
......
......@@ -3,7 +3,7 @@
module Gitlab
module GithubImport
module Stage
class ImportLfsObjectsWorker
class ImportLfsObjectsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include GithubImport::Queue
include StageMethods
......
......@@ -3,7 +3,7 @@
module Gitlab
module GithubImport
module Stage
class ImportNotesWorker
class ImportNotesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include GithubImport::Queue
include StageMethods
......
......@@ -3,7 +3,7 @@
module Gitlab
module GithubImport
module Stage
class ImportPullRequestsWorker
class ImportPullRequestsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include GithubImport::Queue
include StageMethods
......
......@@ -3,7 +3,7 @@
module Gitlab
module GithubImport
module Stage
class ImportRepositoryWorker
class ImportRepositoryWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include GithubImport::Queue
include StageMethods
......
......@@ -18,7 +18,7 @@
# - It marks the import as finished when all remaining jobs are done
module Gitlab
module PhabricatorImport
class BaseWorker
class BaseWorker # rubocop:disable Scalability/IdempotentWorker
include WorkerAttributes
include Gitlab::ExclusiveLeaseHelpers
......
# frozen_string_literal: true
module Gitlab
module PhabricatorImport
class ImportTasksWorker < BaseWorker
class ImportTasksWorker < BaseWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ProjectImportOptions # This marks the project as failed after too many tries
......
# frozen_string_literal: true
class GitlabShellWorker
class GitlabShellWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include Gitlab::ShellAdapter
......
# frozen_string_literal: true
class GitlabUsagePingWorker
class GitlabUsagePingWorker # rubocop:disable Scalability/IdempotentWorker
LEASE_TIMEOUT = 86400
include ApplicationWorker
......
# frozen_string_literal: true
class GroupDestroyWorker
class GroupDestroyWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExceptionBacktrace
......
# frozen_string_literal: true
class GroupExportWorker
class GroupExportWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExceptionBacktrace
......
# frozen_string_literal: true
class GroupImportWorker
class GroupImportWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExceptionBacktrace
......
# frozen_string_literal: true
module HashedStorage
class BaseWorker
class BaseWorker # rubocop:disable Scalability/IdempotentWorker
include ExclusiveLeaseGuard
include WorkerAttributes
......
# frozen_string_literal: true
module HashedStorage
class MigratorWorker
class MigratorWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :hashed_storage
......
# frozen_string_literal: true
module HashedStorage
class ProjectMigrateWorker < BaseWorker
class ProjectMigrateWorker < BaseWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :hashed_storage
......
# frozen_string_literal: true
module HashedStorage
class ProjectRollbackWorker < BaseWorker
class ProjectRollbackWorker < BaseWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :hashed_storage
......
# frozen_string_literal: true
module HashedStorage
class RollbackerWorker
class RollbackerWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :hashed_storage
......
# frozen_string_literal: true
class ImportExportProjectCleanupWorker
class ImportExportProjectCleanupWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext
# This worker does not perform work scoped to a context
......
# frozen_string_literal: true
class ImportIssuesCsvWorker
class ImportIssuesCsvWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :issue_tracking
......
# frozen_string_literal: true
module IncidentManagement
class ProcessAlertWorker
class ProcessAlertWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :incident_management
......
# frozen_string_literal: true
class InvalidGpgSignatureUpdateWorker
class InvalidGpgSignatureUpdateWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
......@@ -3,7 +3,7 @@
require 'json'
require 'socket'
class IrkerWorker
class IrkerWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :integrations
......
# frozen_string_literal: true
class IssueDueSchedulerWorker
class IssueDueSchedulerWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
......
# frozen_string_literal: true
module MailScheduler
class IssueDueWorker
class IssueDueWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include MailSchedulerQueue
......
......@@ -3,7 +3,7 @@
require 'active_job/arguments'
module MailScheduler
class NotificationServiceWorker
class NotificationServiceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include MailSchedulerQueue
......
# frozen_string_literal: true
class MergeRequestMergeabilityCheckWorker
class MergeRequestMergeabilityCheckWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
class MergeWorker
class MergeWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
class MigrateExternalDiffsWorker
class MigrateExternalDiffsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
......@@ -6,7 +6,7 @@
# used to belong to. Projects in this state should be rare.
# The worker will reject doing anything for projects that *do* have a
# namespace. For those use ProjectDestroyWorker instead.
class NamespacelessProjectDestroyWorker
class NamespacelessProjectDestroyWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExceptionBacktrace
......
# frozen_string_literal: true
module Namespaces
class PruneAggregationSchedulesWorker
class PruneAggregationSchedulesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
......
# frozen_string_literal: true
module Namespaces
class RootStatisticsWorker
class RootStatisticsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :update_namespace_statistics
......
# frozen_string_literal: true
module Namespaces
class ScheduleAggregationWorker
class ScheduleAggregationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :update_namespace_statistics
......
# frozen_string_literal: true
class NewIssueWorker
class NewIssueWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include NewIssuable
......
# frozen_string_literal: true
class NewMergeRequestWorker
class NewMergeRequestWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include NewIssuable
......
# frozen_string_literal: true
class NewNoteWorker
class NewNoteWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :issue_tracking
......
# frozen_string_literal: true
class NewReleaseWorker
class NewReleaseWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :notifications
......
# frozen_string_literal: true
module ObjectPool
class CreateWorker
class CreateWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ObjectPoolQueue
include ExclusiveLeaseGuard
......
# frozen_string_literal: true
module ObjectPool
class DestroyWorker
class DestroyWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ObjectPoolQueue
......
# frozen_string_literal: true
module ObjectPool
class JoinWorker
class JoinWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ObjectPoolQueue
......
# frozen_string_literal: true
module ObjectPool
class ScheduleJoinWorker
class ScheduleJoinWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ObjectPoolQueue
......
# frozen_string_literal: true
module ObjectStorage
class BackgroundMoveWorker
class BackgroundMoveWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ObjectStorageQueue
......
# frozen_string_literal: true
# rubocop:disable Scalability/IdempotentWorker
module ObjectStorage
class MigrateUploadsWorker
include ApplicationWorker
......@@ -137,3 +138,4 @@ module ObjectStorage
end
end
end
# rubocop:enable Scalability/IdempotentWorker
# frozen_string_literal: true
class PagesDomainRemovalCronWorker
class PagesDomainRemovalCronWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue
......
# frozen_string_literal: true
class PagesDomainSslRenewalCronWorker
class PagesDomainSslRenewalCronWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue
......
# frozen_string_literal: true
class PagesDomainSslRenewalWorker
class PagesDomainSslRenewalWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :pages
......
# frozen_string_literal: true
class PagesDomainVerificationCronWorker
class PagesDomainVerificationCronWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue
......
# frozen_string_literal: true
class PagesDomainVerificationWorker
class PagesDomainVerificationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :pages
......
# frozen_string_literal: true
class PagesWorker
class PagesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
sidekiq_options retry: 3
......
# frozen_string_literal: true
module PersonalAccessTokens
class ExpiringWorker
class ExpiringWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue
......
# frozen_string_literal: true
class PipelineHooksWorker
class PipelineHooksWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class PipelineMetricsWorker
class PipelineMetricsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class PipelineNotificationWorker
class PipelineNotificationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class PipelineProcessWorker
class PipelineProcessWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class PipelineScheduleWorker
class PipelineScheduleWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue
......
# frozen_string_literal: true
class PipelineSuccessWorker
class PipelineSuccessWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class PipelineUpdateWorker
class PipelineUpdateWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class PostReceive
class PostReceive # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
......@@ -7,7 +7,7 @@
# result of this the workload of this worker should be kept to a bare minimum.
# Consider using an extra worker if you need to add any extra (and potentially
# slow) processing of commits.
class ProcessCommitWorker
class ProcessCommitWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
# Worker for updating any project specific caches.
class ProjectCacheWorker
class ProjectCacheWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
latency_sensitive_worker!
......
# frozen_string_literal: true
class ProjectDailyStatisticsWorker
class ProjectDailyStatisticsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
class ProjectDestroyWorker
class ProjectDestroyWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExceptionBacktrace
......
# frozen_string_literal: true
class ProjectExportWorker
class ProjectExportWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExceptionBacktrace
......
# frozen_string_literal: true
class ProjectServiceWorker
class ProjectServiceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
sidekiq_options dead: false
......
# frozen_string_literal: true
# Worker for updating any project specific caches.
class PropagateServiceTemplateWorker
class PropagateServiceTemplateWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
class PruneOldEventsWorker
class PruneOldEventsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext
# This worker does not perform work scoped to a context
......
......@@ -2,7 +2,7 @@
# Worker that deletes a fixed number of outdated rows from the "web_hook_logs"
# table.
class PruneWebHookLogsWorker
class PruneWebHookLogsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext
# This worker does not perform work scoped to a context
......
# frozen_string_literal: true
class ReactiveCachingWorker
class ReactiveCachingWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category_not_owned!
......
......@@ -2,7 +2,7 @@
# The RebaseWorker must be wrapped in important concurrency code, so should only
# be scheduled via MergeRequest#rebase_async
class RebaseWorker
class RebaseWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
class RemoteMirrorNotificationWorker
class RemoteMirrorNotificationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
class RemoveExpiredGroupLinksWorker
class RemoveExpiredGroupLinksWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
......
# frozen_string_literal: true
class RemoveExpiredMembersWorker
class RemoveExpiredMembersWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
......
# frozen_string_literal: true
class RemoveUnreferencedLfsObjectsWorker
class RemoveUnreferencedLfsObjectsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext
# This worker does not perform work scoped to a context
......
# frozen_string_literal: true
class RepositoryArchiveCacheWorker
class RepositoryArchiveCacheWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext
# This worker does not perform work scoped to a context
......
# frozen_string_literal: true
module RepositoryCheck
class BatchWorker
class BatchWorker # rubocop:disable Scalability/IdempotentWorker
prepend_if_ee('::EE::RepositoryCheck::BatchWorker') # rubocop: disable Cop/InjectEnterpriseEditionModule
include ApplicationWorker
......
# frozen_string_literal: true
module RepositoryCheck
class ClearWorker
class ClearWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include RepositoryCheckQueue
......
# frozen_string_literal: true
module RepositoryCheck
class DispatchWorker
class DispatchWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext
# This worker does not perform work scoped to a context
......
# frozen_string_literal: true
module RepositoryCheck
class SingleRepositoryWorker
class SingleRepositoryWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include RepositoryCheckQueue
......
# frozen_string_literal: true
class RepositoryCleanupWorker
class RepositoryCleanupWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
sidekiq_options retry: 3
......
# frozen_string_literal: true
class RepositoryForkWorker
class RepositoryForkWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include Gitlab::ShellAdapter
include ProjectStartImport
......
# frozen_string_literal: true
class RepositoryImportWorker
class RepositoryImportWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExceptionBacktrace
include ProjectStartImport
......
# frozen_string_literal: true
class RepositoryRemoveRemoteWorker
class RepositoryRemoveRemoteWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExclusiveLeaseGuard
......
# frozen_string_literal: true
class RepositoryUpdateRemoteMirrorWorker
class RepositoryUpdateRemoteMirrorWorker # rubocop:disable Scalability/IdempotentWorker
UpdateError = Class.new(StandardError)
include ApplicationWorker
......
# frozen_string_literal: true
class RequestsProfilesWorker
class RequestsProfilesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext
# This worker does not perform work scoped to a context
......
# frozen_string_literal: true
class RunPipelineScheduleWorker
class RunPipelineScheduleWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class ScheduleMigrateExternalDiffsWorker
class ScheduleMigrateExternalDiffsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext:
# This schedules the `MigrateExternalDiffsWorker`
......
# frozen_string_literal: true
class SelfMonitoringProjectCreateWorker
class SelfMonitoringProjectCreateWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExclusiveLeaseGuard
include SelfMonitoringProjectWorker
......
# frozen_string_literal: true
class SelfMonitoringProjectDeleteWorker
class SelfMonitoringProjectDeleteWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExclusiveLeaseGuard
include SelfMonitoringProjectWorker
......
# frozen_string_literal: true
class StageUpdateWorker
class StageUpdateWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class StuckCiJobsWorker
class StuckCiJobsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue
......
# frozen_string_literal: true
class StuckImportJobsWorker
class StuckImportJobsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext
# This worker updates several import states inline and does not schedule
......
# frozen_string_literal: true
class StuckMergeJobsWorker
class StuckMergeJobsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
......
# frozen_string_literal: true
class SystemHookPushWorker
class SystemHookPushWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
module TodosDestroyer
class ConfidentialIssueWorker
class ConfidentialIssueWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include TodosDestroyerQueue
......
# frozen_string_literal: true
module TodosDestroyer
class EntityLeaveWorker
class EntityLeaveWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include TodosDestroyerQueue
......
# frozen_string_literal: true
module TodosDestroyer
class GroupPrivateWorker
class GroupPrivateWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include TodosDestroyerQueue
......
# frozen_string_literal: true
module TodosDestroyer
class PrivateFeaturesWorker
class PrivateFeaturesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include TodosDestroyerQueue
......
# frozen_string_literal: true
module TodosDestroyer
class ProjectPrivateWorker
class ProjectPrivateWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include TodosDestroyerQueue
......
# frozen_string_literal: true
class TrendingProjectsWorker
class TrendingProjectsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext
# This worker does not perform work scoped to a context
......
# frozen_string_literal: true
class UpdateExternalPullRequestsWorker
class UpdateExternalPullRequestsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
class UpdateHeadPipelineForMergeRequestWorker
class UpdateHeadPipelineForMergeRequestWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue
......
# frozen_string_literal: true
class UpdateMergeRequestsWorker
class UpdateMergeRequestsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
# Worker for updating project statistics.
class UpdateProjectStatisticsWorker
class UpdateProjectStatisticsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management
......
# frozen_string_literal: true
class UploadChecksumWorker
class UploadChecksumWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :geo_replication
......
# frozen_string_literal: true
class WaitForClusterCreationWorker
class WaitForClusterCreationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
......
# frozen_string_literal: true
class WebHookWorker
class WebHookWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :integrations
......
---
title: Add possibility to track milestone changes on issues and merge requests
merge_request: 24780
author:
type: added
---
title: Rescue elasticsearch server error in pod logs
merge_request: 25367
author:
type: fixed
---
title: Use new loading spinner in Todos dashboard buttons
merge_request: 25142
author: Tsegaselassie Tadesse
type: other
......@@ -72,20 +72,21 @@ migration classes must be defined in the namespace
## Scheduling
Scheduling a background migration should be done in a post-deployment migration.
Scheduling a background migration should be done in a post-deployment
migration that includes `Gitlab::Database::MigrationHelpers`
To do so, simply use the following code while
replacing the class name and arguments with whatever values are necessary for
your migration:
```ruby
BackgroundMigrationWorker.perform_async('BackgroundMigrationClassName', [arg1, arg2, ...])
migrate_async('BackgroundMigrationClassName', [arg1, arg2, ...])
```
Usually it's better to enqueue jobs in bulk, for this you can use
`BackgroundMigrationWorker.bulk_perform_async`:
`bulk_migrate_async`:
```ruby
BackgroundMigrationWorker.bulk_perform_async(
bulk_migrate_async(
[['BackgroundMigrationClassName', [1]],
['BackgroundMigrationClassName', [2]]]
)
......@@ -105,7 +106,7 @@ If you would like to schedule jobs in bulk with a delay, you can use
jobs = [['BackgroundMigrationClassName', [1]],
['BackgroundMigrationClassName', [2]]]
BackgroundMigrationWorker.bulk_perform_in(5.minutes, jobs)
bulk_migrate_in(5.minutes, jobs)
```
### Rescheduling background migrations
......
......@@ -688,7 +688,7 @@ module Gitlab
start_id, end_id = batch.pluck('MIN(id), MAX(id)').first
max_index = index
BackgroundMigrationWorker.perform_in(
migrate_in(
index * interval,
'CopyColumn',
[table, column, temp_column, start_id, end_id]
......@@ -697,7 +697,7 @@ module Gitlab
# Schedule the renaming of the column to happen (initially) 1 hour after
# the last batch finished.
BackgroundMigrationWorker.perform_in(
migrate_in(
(max_index * interval) + 1.hour,
'CleanupConcurrentTypeChange',
[table, column, temp_column]
......@@ -779,7 +779,7 @@ module Gitlab
start_id, end_id = batch.pluck('MIN(id), MAX(id)').first
max_index = index
BackgroundMigrationWorker.perform_in(
migrate_in(
index * interval,
'CopyColumn',
[table, old_column, new_column, start_id, end_id]
......@@ -788,7 +788,7 @@ module Gitlab
# Schedule the renaming of the column to happen (initially) 1 hour after
# the last batch finished.
BackgroundMigrationWorker.perform_in(
migrate_in(
(max_index * interval) + 1.hour,
'CleanupConcurrentRename',
[table, old_column, new_column]
......@@ -1024,14 +1024,14 @@ into similar problems in the future (e.g. when new tables are created).
# We push multiple jobs at a time to reduce the time spent in
# Sidekiq/Redis operations. We're using this buffer based approach so we
# don't need to run additional queries for every range.
BackgroundMigrationWorker.bulk_perform_async(jobs)
bulk_migrate_async(jobs)
jobs.clear
end
jobs << [job_class_name, [start_id, end_id]]
end
BackgroundMigrationWorker.bulk_perform_async(jobs) unless jobs.empty?
bulk_migrate_async(jobs) unless jobs.empty?
end
# Queues background migration jobs for an entire table, batched by ID range.
......@@ -1074,7 +1074,7 @@ into similar problems in the future (e.g. when new tables are created).
# `BackgroundMigrationWorker.bulk_perform_in` schedules all jobs for
# the same time, which is not helpful in most cases where we wish to
# spread the work over time.
BackgroundMigrationWorker.perform_in(delay_interval * index, job_class_name, [start_id, end_id])
migrate_in(delay_interval * index, job_class_name, [start_id, end_id])
end
end
......@@ -1133,6 +1133,30 @@ into similar problems in the future (e.g. when new tables are created).
execute(sql)
end
def migrate_async(*args)
with_migration_context do
BackgroundMigrationWorker.perform_async(*args)
end
end
def migrate_in(*args)
with_migration_context do
BackgroundMigrationWorker.perform_in(*args)
end
end
def bulk_migrate_in(*args)
with_migration_context do
BackgroundMigrationWorker.bulk_perform_in(*args)
end
end
def bulk_migrate_async(*args)
with_migration_context do
BackgroundMigrationWorker.bulk_perform_async(*args)
end
end
private
def tables_match?(target_table, foreign_key_table)
......@@ -1191,6 +1215,10 @@ into similar problems in the future (e.g. when new tables are created).
your migration class
ERROR
end
def with_migration_context(&block)
Gitlab::ApplicationContext.with_context(caller_id: self.class.to_s, &block)
end
end
end
end
......@@ -11,6 +11,7 @@ module Gitlab
has_external_dependencies: :worker_has_external_dependencies?,
latency_sensitive: :latency_sensitive_worker?,
resource_boundary: :get_worker_resource_boundary,
idempotent: :idempotent?,
weight: :get_weight
}.freeze
......
......@@ -7,7 +7,7 @@ module Gitlab
attr_reader :klass
delegate :feature_category_not_owned?, :get_feature_category,
:get_weight, :get_worker_resource_boundary,
:get_weight, :get_worker_resource_boundary, :idempotent?,
:latency_sensitive_worker?, :queue, :queue_namespace,
:worker_has_external_dependencies?,
to: :klass
......@@ -51,7 +51,8 @@ module Gitlab
has_external_dependencies: worker_has_external_dependencies?,
latency_sensitive: latency_sensitive_worker?,
resource_boundary: get_worker_resource_boundary,
weight: get_weight
weight: get_weight,
idempotent: idempotent?
}
end
......
......@@ -7044,6 +7044,9 @@ msgstr ""
msgid "Elasticsearch integration. Elasticsearch AWS IAM."
msgstr ""
msgid "Elasticsearch returned status code: %{status_code}"
msgstr ""
msgid "Elastic|None. Select namespaces to index."
msgstr ""
......
# frozen_string_literal: true
require_relative '../../migration_helpers'
module RuboCop
module Cop
module Migration
class ScheduleAsync < RuboCop::Cop::Cop
include MigrationHelpers
ENFORCED_SINCE = 2020_02_12_00_00_00
MSG = <<~MSG
Don't call the background migration worker directly, use the `#migrate_async`,
`#migrate_in`, `#bulk_migrate_async` or `#bulk_migrate_in` migration helpers
instead.
MSG
def_node_matcher :calls_background_migration_worker?, <<~PATTERN
(send (const nil? :BackgroundMigrationWorker) {:perform_async :perform_in :bulk_perform_async :bulk_perform_in} ... )
PATTERN
def on_send(node)
return unless in_migration?(node)
return if version(node) < ENFORCED_SINCE
add_offense(node, location: :expression) if calls_background_migration_worker?(node)
end
def autocorrect(node)
# This gets rid of the receiver `BackgroundMigrationWorker` and
# replaces `perform` with `schedule`
schedule_method = method_name(node).to_s.sub('perform', 'migrate')
arguments = arguments(node).map(&:source).join(', ')
replacement = "#{schedule_method}(#{arguments})"
lambda do |corrector|
corrector.replace(node.source_range, replacement)
end
end
private
def method_name(node)
node.children.second
end
def arguments(node)
node.children[2..-1]
end
end
end
end
end
# frozen_string_literal: true
require_relative '../../code_reuse_helpers.rb'
module RuboCop
module Cop
module Scalability
# This cop checks for the `idempotent!` call in the worker scope.
#
# @example
#
# # bad
# class TroubleMakerWorker
# def perform
# end
# end
#
# # good
# class NiceWorker
# idempotent!
#
# def perform
# end
# end
#
class IdempotentWorker < RuboCop::Cop::Cop
include CodeReuseHelpers
HELP_LINK = 'https://github.com/mperham/sidekiq/wiki/Best-Practices#2-make-your-job-idempotent-and-transactional'
MSG = <<~MSG
Avoid adding not idempotent workers.
A worker is considered idempotent if:
1. It can safely run multiple times with the same arguments
2. The application side-effects are expected to happen once (or side-effects of a second run are not impactful)
3. It can safely be skipped if another job with the same arguments is already in the queue
If all the above is true, make sure to mark it as so by calling the `idempotent!`
method in the worker scope.
See #{HELP_LINK}
MSG
def_node_search :idempotent?, <<~PATTERN
(send nil? :idempotent!)
PATTERN
def on_class(node)
return unless in_worker?(node)
return if idempotent?(node)
add_offense(node, location: :expression)
end
end
end
end
end
......@@ -10,6 +10,10 @@ module RuboCop
dirname(node).end_with?('db/post_migrate', 'db/geo/post_migrate')
end
def version(node)
File.basename(node.location.expression.source_buffer.name).split('_').first.to_i
end
private
def dirname(node)
......
......@@ -135,6 +135,10 @@ describe Projects::MilestonesController do
end
describe "#destroy" do
before do
stub_feature_flags(track_resource_milestone_change_events: false)
end
it "removes milestone" do
expect(issue.milestone_id).to eq(milestone.id)
......
# frozen_string_literal: true
FactoryBot.define do
factory :resource_milestone_event do
issue { merge_request.nil? ? create(:issue) : nil }
merge_request { nil }
milestone
action { :add }
state { :opened }
user { issue&.author || merge_request&.author || create(:user) }
end
end
......@@ -1893,4 +1893,60 @@ describe Gitlab::Database::MigrationHelpers do
end
end
end
describe '#migrate_async' do
it 'calls BackgroundMigrationWorker.perform_async' do
expect(BackgroundMigrationWorker).to receive(:perform_async).with("Class", "hello", "world")
model.migrate_async("Class", "hello", "world")
end
it 'pushes a context with the current class name as caller_id' do
expect(Gitlab::ApplicationContext).to receive(:with_context).with(caller_id: model.class.to_s)
model.migrate_async('Class', 'hello', 'world')
end
end
describe '#migrate_in' do
it 'calls BackgroundMigrationWorker.perform_in' do
expect(BackgroundMigrationWorker).to receive(:perform_in).with(10.minutes, 'Class', 'Hello', 'World')
model.migrate_in(10.minutes, 'Class', 'Hello', 'World')
end
it 'pushes a context with the current class name as caller_id' do
expect(Gitlab::ApplicationContext).to receive(:with_context).with(caller_id: model.class.to_s)
model.migrate_in(10.minutes, 'Class', 'Hello', 'World')
end
end
describe '#bulk_migrate_async' do
it 'calls BackgroundMigrationWorker.bulk_perform_async' do
expect(BackgroundMigrationWorker).to receive(:bulk_perform_async).with([%w(Class hello world)])
model.bulk_migrate_async([%w(Class hello world)])
end
it 'pushes a context with the current class name as caller_id' do
expect(Gitlab::ApplicationContext).to receive(:with_context).with(caller_id: model.class.to_s)
model.bulk_migrate_async([%w(Class hello world)])
end
end
describe '#bulk_migrate_in' do
it 'calls BackgroundMigrationWorker.bulk_perform_in_' do
expect(BackgroundMigrationWorker).to receive(:bulk_perform_in).with(10.minutes, [%w(Class hello world)])
model.bulk_migrate_in(10.minutes, [%w(Class hello world)])
end
it 'pushes a context with the current class name as caller_id' do
expect(Gitlab::ApplicationContext).to receive(:with_context).with(caller_id: model.class.to_s)
model.bulk_migrate_in(10.minutes, [%w(Class hello world)])
end
end
end
......@@ -9,6 +9,7 @@ issues:
- notes
- resource_label_events
- resource_weight_events
- resource_milestone_events
- sentry_issue
- label_links
- labels
......@@ -109,6 +110,7 @@ merge_requests:
- milestone
- notes
- resource_label_events
- resource_milestone_events
- label_links
- labels
- last_edited_by
......
......@@ -12,7 +12,8 @@ describe Gitlab::SidekiqConfig::Worker do
get_weight: attributes[:weight],
get_worker_resource_boundary: attributes[:resource_boundary],
latency_sensitive_worker?: attributes[:latency_sensitive],
worker_has_external_dependencies?: attributes[:has_external_dependencies]
worker_has_external_dependencies?: attributes[:has_external_dependencies],
idempotent?: attributes[:idempotent]
)
described_class.new(inner_worker, ee: false)
......@@ -89,7 +90,8 @@ describe Gitlab::SidekiqConfig::Worker do
has_external_dependencies: false,
latency_sensitive: false,
resource_boundary: :memory,
weight: 2
weight: 2,
idempotent: true
}
attributes_b = {
......@@ -97,7 +99,8 @@ describe Gitlab::SidekiqConfig::Worker do
has_external_dependencies: true,
latency_sensitive: true,
resource_boundary: :unknown,
weight: 1
weight: 3,
idempotent: false
}
worker_a = create_worker(queue: 'a', **attributes_a)
......
# frozen_string_literal: true
require 'spec_helper'
describe MilestoneNote do
describe '.from_event' do
let(:author) { create(:user) }
let(:project) { create(:project, :repository) }
let(:noteable) { create(:issue, author: author, project: project) }
let(:event) { create(:resource_milestone_event, issue: noteable) }
subject { described_class.from_event(event, resource: noteable, resource_parent: project) }
it_behaves_like 'a system note', exclude_project: true do
let(:action) { 'milestone' }
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe ResourceMilestoneEvent, type: :model do
it_behaves_like 'a resource event'
it_behaves_like 'a resource event for issues'
it_behaves_like 'a resource event for merge requests'
it_behaves_like 'having unique enum values'
describe 'associations' do
it { is_expected.to belong_to(:milestone) }
end
describe 'validations' do
context 'when issue and merge_request are both nil' do
subject { build(described_class.name.underscore.to_sym, issue: nil, merge_request: nil) }
it { is_expected.not_to be_valid }
end
context 'when issue and merge_request are both set' do
subject { build(described_class.name.underscore.to_sym, issue: build(:issue), merge_request: build(:merge_request)) }
it { is_expected.not_to be_valid }
end
context 'when issue is set' do
subject { create(described_class.name.underscore.to_sym, issue: create(:issue), merge_request: nil) }
it { is_expected.to be_valid }
end
context 'when merge_request is set' do
subject { create(described_class.name.underscore.to_sym, issue: nil, merge_request: create(:merge_request)) }
it { is_expected.to be_valid }
end
end
describe 'states' do
[Issue, MergeRequest].each do |klass|
klass.available_states.each do |state|
it "supports state #{state.first} for #{klass.name.underscore}" do
model = create(klass.name.underscore, state: state[0])
key = model.class.name.underscore
event = build(described_class.name.underscore.to_sym, key => model, state: model.state)
expect(event.state).to eq(state[0])
end
end
end
end
end
# frozen_string_literal: true
require 'fast_spec_helper'
require 'rubocop'
require 'rubocop/rspec/support'
require_relative '../../../../rubocop/cop/migration/schedule_async'
describe RuboCop::Cop::Migration::ScheduleAsync do
include CopHelper
let(:cop) { described_class.new }
let(:source) do
<<~SOURCE
def up
BackgroundMigrationWorker.perform_async(ClazzName, "Bar", "Baz")
end
SOURCE
end
shared_examples 'a disabled cop' do
it 'does not register any offenses' do
inspect_source(source)
expect(cop.offenses).to be_empty
end
end
context 'outside of a migration' do
it_behaves_like 'a disabled cop'
end
context 'in a migration' do
before do
allow(cop).to receive(:in_migration?).and_return(true)
end
context 'in an old migration' do
before do
allow(cop).to receive(:version).and_return(described_class::ENFORCED_SINCE - 5)
end
it_behaves_like 'a disabled cop'
end
context 'that is recent' do
before do
allow(cop).to receive(:version).and_return(described_class::ENFORCED_SINCE + 5)
end
context 'BackgroundMigrationWorker.perform_async' do
it 'adds an offence when calling `BackgroundMigrationWorker.peform_async`' do
inspect_source(source)
expect(cop.offenses.size).to eq(1)
end
it 'autocorrects to the right version' do
correct_source = <<~CORRECT
def up
migrate_async(ClazzName, "Bar", "Baz")
end
CORRECT
expect(autocorrect_source(source)).to eq(correct_source)
end
end
context 'BackgroundMigrationWorker.perform_in' do
let(:source) do
<<~SOURCE
def up
BackgroundMigrationWorker
.perform_in(delay, ClazzName, "Bar", "Baz")
end
SOURCE
end
it 'adds an offence' do
inspect_source(source)
expect(cop.offenses.size).to eq(1)
end
it 'autocorrects to the right version' do
correct_source = <<~CORRECT
def up
migrate_in(delay, ClazzName, "Bar", "Baz")
end
CORRECT
expect(autocorrect_source(source)).to eq(correct_source)
end
end
context 'BackgroundMigrationWorker.bulk_perform_async' do
let(:source) do
<<~SOURCE
def up
BackgroundMigrationWorker
.bulk_perform_async(jobs)
end
SOURCE
end
it 'adds an offence' do
inspect_source(source)
expect(cop.offenses.size).to eq(1)
end
it 'autocorrects to the right version' do
correct_source = <<~CORRECT
def up
bulk_migrate_async(jobs)
end
CORRECT
expect(autocorrect_source(source)).to eq(correct_source)
end
end
context 'BackgroundMigrationWorker.bulk_perform_in' do
let(:source) do
<<~SOURCE
def up
BackgroundMigrationWorker
.bulk_perform_in(5.minutes, jobs)
end
SOURCE
end
it 'adds an offence' do
inspect_source(source)
expect(cop.offenses.size).to eq(1)
end
it 'autocorrects to the right version' do
correct_source = <<~CORRECT
def up
bulk_migrate_in(5.minutes, jobs)
end
CORRECT
expect(autocorrect_source(source)).to eq(correct_source)
end
end
end
end
end
# frozen_string_literal: true
require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../support/helpers/expect_offense'
require_relative '../../../../rubocop/cop/scalability/idempotent_worker'
describe RuboCop::Cop::Scalability::IdempotentWorker do
include CopHelper
include ExpectOffense
subject(:cop) { described_class.new }
before do
allow(cop)
.to receive(:in_worker?)
.and_return(true)
end
it 'adds an offense when not defining idempotent method' do
inspect_source(<<~CODE.strip_indent)
class SomeWorker
end
CODE
expect(cop.offenses.size).to eq(1)
end
it 'adds an offense when not defining idempotent method' do
inspect_source(<<~CODE.strip_indent)
class SomeWorker
idempotent!
end
CODE
expect(cop.offenses.size).to be_zero
end
end
# frozen_string_literal: true
require 'fast_spec_helper'
require 'rubocop'
require 'rspec-parameterized'
require_relative '../../rubocop/migration_helpers'
describe RuboCop::MigrationHelpers do
using RSpec::Parameterized::TableSyntax
subject(:fake_cop) { Class.new { include RuboCop::MigrationHelpers }.new }
let(:node) { double(:node) }
before do
allow(node).to receive_message_chain('location.expression.source_buffer.name')
.and_return(name)
end
describe '#in_migration?' do
where(:name, :expected) do
'/gitlab/db/migrate/20200210184420_create_operations_scopes_table.rb' | true
'/gitlab/db/post_migrate/20200210184420_create_operations_scopes_table.rb' | true
'/gitlab/db/geo/migrate/20200210184420_create_operations_scopes_table.rb' | true
'/gitlab/db/geo/post_migrate/20200210184420_create_operations_scopes_table.rb' | true
'/gitlab/db/elsewhere/20200210184420_create_operations_scopes_table.rb' | false
end
with_them do
it { expect(fake_cop.in_migration?(node)).to eq(expected) }
end
end
describe '#in_post_deployment_migration?' do
where(:name, :expected) do
'/gitlab/db/migrate/20200210184420_create_operations_scopes_table.rb' | false
'/gitlab/db/post_migrate/20200210184420_create_operations_scopes_table.rb' | true
'/gitlab/db/geo/migrate/20200210184420_create_operations_scopes_table.rb' | false
'/gitlab/db/geo/post_migrate/20200210184420_create_operations_scopes_table.rb' | true
'/gitlab/db/elsewhere/20200210184420_create_operations_scopes_table.rb' | false
end
with_them do
it { expect(fake_cop.in_post_deployment_migration?(node)).to eq(expected) }
end
end
describe "#version" do
let(:name) do
'/path/to/gitlab/db/migrate/20200210184420_create_operations_scopes_table.rb'
end
it { expect(fake_cop.version(node)).to eq(20200210184420) }
end
end
......@@ -75,5 +75,47 @@ describe Issuable::Clone::AttributesRewriter do
expect(new_issue.reload.milestone).to eq(milestone)
end
context 'with existing milestone events' do
let!(:milestone1_project1) { create(:milestone, title: 'milestone1', project: project1) }
let!(:milestone2_project1) { create(:milestone, title: 'milestone2', project: project1) }
let!(:milestone3_project1) { create(:milestone, title: 'milestone3', project: project1) }
let!(:milestone1_project2) { create(:milestone, title: 'milestone1', project: project2) }
let!(:milestone2_project2) { create(:milestone, title: 'milestone2', project: project2) }
before do
original_issue.update(milestone: milestone2_project1)
create_event(milestone1_project1)
create_event(milestone2_project1)
create_event(milestone1_project1, 'remove')
create_event(milestone3_project1)
end
it 'copies existing resource milestone events' do
subject.execute
new_issue_milestone_events = new_issue.reload.resource_milestone_events
expect(new_issue_milestone_events.count).to eq(3)
expect_milestone_event(new_issue_milestone_events.first, milestone: milestone1_project2, action: 'add', state: 'opened')
expect_milestone_event(new_issue_milestone_events.second, milestone: milestone2_project2, action: 'add', state: 'opened')
expect_milestone_event(new_issue_milestone_events.third, milestone: milestone1_project2, action: 'remove', state: 'opened')
end
def create_event(milestone, action = 'add')
create(:resource_milestone_event, issue: original_issue, milestone: milestone, action: action)
end
def expect_milestone_event(event, expected_attrs)
expect(event.milestone_id).to eq(expected_attrs[:milestone].id)
expect(event.action).to eq(expected_attrs[:action])
expect(event.state).to eq(expected_attrs[:state])
expect(event.reference).to be_nil
expect(event.reference_html).to be_nil
end
end
end
end
......@@ -3,8 +3,9 @@
require 'spec_helper'
describe Issuable::CommonSystemNotesService do
let(:user) { create(:user) }
let(:project) { create(:project) }
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let(:issuable) { create(:issue, project: project) }
context 'on issuable update' do
......@@ -35,6 +36,8 @@ describe Issuable::CommonSystemNotesService do
before do
milestone = create(:milestone, project: project)
issuable.milestone_id = milestone.id
stub_feature_flags(track_resource_milestone_change_events: false)
end
it_behaves_like 'system note creation', {}, 'changed milestone'
......@@ -97,12 +100,39 @@ describe Issuable::CommonSystemNotesService do
expect(event.user_id).to eq user.id
end
it 'creates a system note for milestone set' do
issuable.milestone = create(:milestone, project: project)
issuable.save
context 'when milestone change event tracking is disabled' do
before do
stub_feature_flags(track_resource_milestone_change_events: false)
expect { subject }.to change { issuable.notes.count }.from(0).to(1)
expect(issuable.notes.last.note).to match('changed milestone')
issuable.milestone = create(:milestone, project: project)
issuable.save
end
it 'creates a system note for milestone set' do
expect { subject }.to change { issuable.notes.count }.from(0).to(1)
expect(issuable.notes.last.note).to match('changed milestone')
end
it 'does not create a milestone change event' do
expect { subject }.not_to change { ResourceMilestoneEvent.count }
end
end
context 'when milestone change event tracking is enabled' do
let_it_be(:milestone) { create(:milestone, project: project) }
let_it_be(:issuable) { create(:issue, project: project, milestone: milestone) }
before do
stub_feature_flags(track_resource_milestone_change_events: true)
end
it 'does not create a system note for milestone set' do
expect { subject }.not_to change { issuable.notes.count }
end
it 'creates a milestone change event' do
expect { subject }.to change { ResourceMilestoneEvent.count }.from(0).to(1)
end
end
it 'creates a system note for due_date set' do
......
......@@ -385,6 +385,10 @@ describe Issues::UpdateService, :mailer do
end
context 'when the milestone is removed' do
before do
stub_feature_flags(track_resource_milestone_change_events: false)
end
let!(:non_subscriber) { create(:user) }
let!(:subscriber) do
......@@ -411,6 +415,10 @@ describe Issues::UpdateService, :mailer do
end
context 'when the milestone is changed' do
before do
stub_feature_flags(track_resource_milestone_change_events: false)
end
let!(:non_subscriber) { create(:user) }
let!(:subscriber) do
......
......@@ -367,6 +367,10 @@ describe MergeRequests::UpdateService, :mailer do
end
context 'when the milestone is removed' do
before do
stub_feature_flags(track_resource_milestone_change_events: false)
end
let!(:non_subscriber) { create(:user) }
let!(:subscriber) do
......@@ -393,6 +397,10 @@ describe MergeRequests::UpdateService, :mailer do
end
context 'when the milestone is changed' do
before do
stub_feature_flags(track_resource_milestone_change_events: false)
end
let!(:non_subscriber) { create(:user) }
let!(:subscriber) do
......
# frozen_string_literal: true
require 'spec_helper'
describe ResourceEvents::ChangeMilestoneService do
shared_examples 'milestone events creator' do
let_it_be(:user) { create(:user) }
let_it_be(:milestone) { create(:milestone) }
context 'when milestone is present' do
before do
resource.milestone = milestone
end
let(:service) { described_class.new(resource: resource, user: user, created_at: created_at_time) }
it 'creates the expected event record' do
expect { service.execute }.to change { ResourceMilestoneEvent.count }.from(0).to(1)
events = ResourceMilestoneEvent.all
expect(events.size).to eq(1)
expect_event_record(events.first, action: 'add', milestone: milestone, state: 'opened')
end
end
context 'when milestones is not present' do
before do
resource.milestone = nil
end
let(:service) { described_class.new(resource: resource, user: user, created_at: created_at_time) }
it 'creates the expected event records' do
expect { service.execute }.to change { ResourceMilestoneEvent.count }.from(0).to(1)
expect_event_record(ResourceMilestoneEvent.first, action: 'remove', milestone: nil, state: 'opened')
end
end
def expect_event_record(event, expected_attrs)
expect(event.action).to eq(expected_attrs[:action])
expect(event.state).to eq(expected_attrs[:state])
expect(event.user).to eq(user)
expect(event.issue).to eq(resource) if resource.is_a?(Issue)
expect(event.issue).to be_nil unless resource.is_a?(Issue)
expect(event.merge_request).to eq(resource) if resource.is_a?(MergeRequest)
expect(event.merge_request).to be_nil unless resource.is_a?(MergeRequest)
expect(event.milestone).to eq(expected_attrs[:milestone])
expect(event.created_at).to eq(created_at_time)
end
end
let_it_be(:merge_request) { create(:merge_request) }
let_it_be(:issue) { create(:issue) }
let!(:created_at_time) { Time.utc(2019, 12, 30) }
it_behaves_like 'milestone events creator' do
let(:resource) { issue }
end
it_behaves_like 'milestone events creator' do
let(:resource) { merge_request }
end
end
......@@ -119,6 +119,7 @@ RSpec.configure do |config|
config.include PolicyHelpers, type: :policy
config.include MemoryUsageHelper
config.include ExpectRequestWithStatus, type: :request
config.include IdempotentWorkerHelper, type: :worker
config.include RailsHelpers
if ENV['CI'] || ENV['RETRIES']
......
# frozen_string_literal: true
module IdempotentWorkerHelper
WORKER_EXEC_TIMES = 2
def perform_multiple(args = [], worker: described_class.new, exec_times: WORKER_EXEC_TIMES)
Sidekiq::Testing.inline! do
job_args = args.nil? ? [nil] : Array.wrap(args)
expect(worker).to receive(:perform).exactly(exec_times).and_call_original
exec_times.times { worker.perform(*job_args) }
end
end
end
......@@ -50,6 +50,8 @@ RSpec.shared_examples 'move quick action' do
let(:bug) { create(:label, project: project, title: 'bug') }
let(:wontfix) { create(:label, project: project, title: 'wontfix') }
let!(:target_milestone) { create(:milestone, title: '1.0', project: target_project) }
before do
target_project.add_maintainer(user)
end
......
# frozen_string_literal: true
require 'spec_helper'
shared_examples 'a resource event' do
let_it_be(:user1) { create(:user) }
let_it_be(:user2) { create(:user) }
let_it_be(:issue1) { create(:issue, author: user1) }
let_it_be(:issue2) { create(:issue, author: user1) }
let_it_be(:issue3) { create(:issue, author: user2) }
describe 'validations' do
it { is_expected.not_to allow_value(nil).for(:user) }
end
describe 'associations' do
it { is_expected.to belong_to(:user) }
end
describe '.created_after' do
let!(:created_at1) { 1.day.ago }
let!(:created_at2) { 2.days.ago }
let!(:created_at3) { 3.days.ago }
let!(:event1) { create(described_class.name.underscore.to_sym, issue: issue1, created_at: created_at1) }
let!(:event2) { create(described_class.name.underscore.to_sym, issue: issue2, created_at: created_at2) }
let!(:event3) { create(described_class.name.underscore.to_sym, issue: issue2, created_at: created_at3) }
it 'returns the expected events' do
events = described_class.created_after(created_at3)
expect(events).to contain_exactly(event1, event2)
end
it 'returns no events if time is after last record time' do
events = described_class.created_after(1.minute.ago)
expect(events).to be_empty
end
end
end
shared_examples 'a resource event for issues' do
let_it_be(:user1) { create(:user) }
let_it_be(:user2) { create(:user) }
let_it_be(:issue1) { create(:issue, author: user1) }
let_it_be(:issue2) { create(:issue, author: user1) }
let_it_be(:issue3) { create(:issue, author: user2) }
describe 'associations' do
it { is_expected.to belong_to(:issue) }
end
describe '.by_issue' do
let_it_be(:event1) { create(described_class.name.underscore.to_sym, issue: issue1) }
let_it_be(:event2) { create(described_class.name.underscore.to_sym, issue: issue2) }
let_it_be(:event3) { create(described_class.name.underscore.to_sym, issue: issue1) }
it 'returns the expected records for an issue with events' do
events = described_class.by_issue(issue1)
expect(events).to contain_exactly(event1, event3)
end
it 'returns the expected records for an issue with no events' do
events = described_class.by_issue(issue3)
expect(events).to be_empty
end
end
end
shared_examples 'a resource event for merge requests' do
let_it_be(:user1) { create(:user) }
let_it_be(:user2) { create(:user) }
let_it_be(:merge_request1) { create(:merge_request, author: user1) }
let_it_be(:merge_request2) { create(:merge_request, author: user1) }
let_it_be(:merge_request3) { create(:merge_request, author: user2) }
describe 'associations' do
it { is_expected.to belong_to(:merge_request) }
end
describe '.by_merge_request' do
let_it_be(:event1) { create(described_class.name.underscore.to_sym, merge_request: merge_request1) }
let_it_be(:event2) { create(described_class.name.underscore.to_sym, merge_request: merge_request2) }
let_it_be(:event3) { create(described_class.name.underscore.to_sym, merge_request: merge_request1) }
it 'returns the expected records for an issue with events' do
events = described_class.by_merge_request(merge_request1)
expect(events).to contain_exactly(event1, event3)
end
it 'returns the expected records for an issue with no events' do
events = described_class.by_merge_request(merge_request3)
expect(events).to be_empty
end
end
end
# frozen_string_literal: true
# This shared_example requires the following variables:
# - job_args (if not given, will fallback to call perform without arguments)
#
# Usage:
#
# include_examples 'an idempotent worker' do
# it 'checks the side-effects for multiple calls' do
# # it'll call the job's perform method 3 times
# # by default.
# subject
#
# expect(model.state).to eq('state')
# end
# end
#
RSpec.shared_examples 'an idempotent worker' do
# Avoid stubbing calls for a more accurate run.
subject do
defined?(job_args) ? perform_multiple(job_args) : perform_multiple
end
it 'is labeled as idempotent' do
expect(described_class).to be_idempotent
end
it 'performs multiple times sequentially without raising an exception' do
expect { subject }.not_to raise_error
end
end
......@@ -11,7 +11,7 @@ describe BackgroundMigrationWorker, :clean_gitlab_redis_shared_state do
end
end
describe '.perform' do
describe '#perform' do
it 'performs a background migration' do
expect(Gitlab::BackgroundMigration)
.to receive(:perform)
......@@ -52,6 +52,14 @@ describe BackgroundMigrationWorker, :clean_gitlab_redis_shared_state do
worker.perform('Foo', [10, 20])
end
it 'sets the class that will be executed as the caller_id' do
expect(Gitlab::BackgroundMigration).to receive(:perform) do
expect(Labkit::Context.current.to_h).to include('meta.caller_id' => 'Foo')
end
worker.perform('Foo', [10, 20])
end
end
describe '#healthy_database?' do
......
......@@ -6,20 +6,32 @@ describe ExpireJobCacheWorker do
set(:pipeline) { create(:ci_empty_pipeline) }
let(:project) { pipeline.project }
subject { described_class.new }
describe '#perform' do
context 'with a job in the pipeline' do
let(:job) { create(:ci_build, pipeline: pipeline) }
let(:job_args) { job.id }
include_examples 'an idempotent worker' do
it 'invalidates Etag caching for the job path' do
pipeline_path = "/#{project.full_path}/pipelines/#{pipeline.id}.json"
job_path = "/#{project.full_path}/builds/#{job.id}.json"
spy_store = Gitlab::EtagCaching::Store.new
allow(Gitlab::EtagCaching::Store).to receive(:new) { spy_store }
it 'invalidates Etag caching for the job path' do
pipeline_path = "/#{project.full_path}/pipelines/#{pipeline.id}.json"
job_path = "/#{project.full_path}/builds/#{job.id}.json"
expect(spy_store).to receive(:touch)
.exactly(IdempotentWorkerHelper::WORKER_EXEC_TIMES).times
.with(pipeline_path)
.and_call_original
expect_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch).with(pipeline_path)
expect_any_instance_of(Gitlab::EtagCaching::Store).to receive(:touch).with(job_path)
expect(spy_store).to receive(:touch)
.exactly(IdempotentWorkerHelper::WORKER_EXEC_TIMES).times
.with(job_path)
.and_call_original
subject.perform(job.id)
subject
end
end
end
......@@ -27,7 +39,7 @@ describe ExpireJobCacheWorker do
it 'does not change the etag store' do
expect(Gitlab::EtagCaching::Store).not_to receive(:new)
subject.perform(9999)
perform_multiple(9999)
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment