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 { ...@@ -110,14 +110,6 @@ export default {
board.name.toLowerCase().includes(this.filterTerm.toLowerCase()), board.name.toLowerCase().includes(this.filterTerm.toLowerCase()),
); );
}, },
reload: {
get() {
return this.state.reload;
},
set(newValue) {
this.state.reload = newValue;
},
},
board() { board() {
return this.state.currentBoard; return this.state.currentBoard;
}, },
...@@ -142,16 +134,6 @@ export default { ...@@ -142,16 +134,6 @@ export default {
this.scrollFadeInitialized = false; this.scrollFadeInitialized = false;
this.$nextTick(this.setScrollFade); this.$nextTick(this.setScrollFade);
}, },
reload() {
if (this.reload) {
this.boards = [];
this.recentBoards = [];
this.loading = true;
this.reload = false;
this.loadBoards(false);
}
},
}, },
created() { created() {
boardsStore.setCurrentBoard(this.currentBoard); boardsStore.setCurrentBoard(this.currentBoard);
......
...@@ -30,7 +30,6 @@ const boardsStore = { ...@@ -30,7 +30,6 @@ const boardsStore = {
labels: [], labels: [],
}, },
currentPage: '', currentPage: '',
reload: false,
endpoints: {}, endpoints: {},
}, },
detail: { detail: {
...@@ -61,7 +60,6 @@ const boardsStore = { ...@@ -61,7 +60,6 @@ const boardsStore = {
}; };
}, },
showPage(page) { showPage(page) {
this.state.reload = false;
this.state.currentPage = page; this.state.currentPage = page;
}, },
addList(listObj, defaultAvatar) { addList(listObj, defaultAvatar) {
......
...@@ -371,9 +371,12 @@ ...@@ -371,9 +371,12 @@
} }
.btn-loading { .btn-loading {
&:not(.disabled) .fa { &:not(.disabled) {
.fa,
.spinner {
display: none; display: none;
} }
}
.fa { .fa {
margin-right: 5px; margin-right: 5px;
......
# 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 ...@@ -15,6 +15,7 @@ class Issue < ApplicationRecord
include ThrottledTouch include ThrottledTouch
include LabelEventable include LabelEventable
include IgnorableColumns include IgnorableColumns
include MilestoneEventable
DueDateStruct = Struct.new(:title, :name).freeze DueDateStruct = Struct.new(:title, :name).freeze
NoDueDate = DueDateStruct.new('No Due Date', '0').freeze NoDueDate = DueDateStruct.new('No Due Date', '0').freeze
......
...@@ -18,6 +18,7 @@ class MergeRequest < ApplicationRecord ...@@ -18,6 +18,7 @@ class MergeRequest < ApplicationRecord
include DeprecatedAssignee include DeprecatedAssignee
include ShaAttribute include ShaAttribute
include IgnorableColumns include IgnorableColumns
include MilestoneEventable
sha_attribute :squash_commit_sha 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 ...@@ -4,20 +4,17 @@ class ResourceLabelEvent < ApplicationRecord
include Importable include Importable
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
include CacheMarkdownField include CacheMarkdownField
include ResourceEventTools
cache_markdown_field :reference cache_markdown_field :reference
belongs_to :user
belongs_to :issue belongs_to :issue
belongs_to :merge_request belongs_to :merge_request
belongs_to :label belongs_to :label
scope :created_after, ->(time) { where('created_at > ?', time) }
scope :inc_relations, -> { includes(:label, :user) } scope :inc_relations, -> { includes(:label, :user) }
validates :user, presence: { unless: :importing? }, on: :create
validates :label, presence: { unless: :importing? }, on: :create validates :label, presence: { unless: :importing? }, on: :create
validate :exactly_one_issuable
after_save :expire_etag_cache after_save :expire_etag_cache
after_destroy :expire_etag_cache after_destroy :expire_etag_cache
...@@ -94,22 +91,6 @@ class ResourceLabelEvent < ApplicationRecord ...@@ -94,22 +91,6 @@ class ResourceLabelEvent < ApplicationRecord
end end
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 def expire_etag_cache
issuable.expire_note_etag_cache issuable.expire_note_etag_cache
end 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 ...@@ -19,6 +19,7 @@ module Issuable
copy_resource_label_events copy_resource_label_events
copy_resource_weight_events copy_resource_weight_events
copy_resource_milestone_events
end end
private private
...@@ -65,6 +66,23 @@ module Issuable ...@@ -65,6 +66,23 @@ module Issuable
end end
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) def copy_events(table_name, events_to_copy)
events_to_copy.find_in_batches do |batch| events_to_copy.find_in_batches do |batch|
events = batch.map do |event| events = batch.map do |event|
......
...@@ -22,13 +22,17 @@ module Issuable ...@@ -22,13 +22,17 @@ module Issuable
end end
create_due_date_note if issuable.previous_changes.include?('due_date') 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 create_labels_note(old_labels) if old_labels && issuable.labels != old_labels
end end
end end
private private
def has_milestone_changes?
issuable.previous_changes.include?('milestone_id')
end
def handle_time_tracking_note def handle_time_tracking_note
if issuable.previous_changes.include?('time_estimate') if issuable.previous_changes.include?('time_estimate')
create_time_estimate_note create_time_estimate_note
...@@ -95,8 +99,17 @@ module Issuable ...@@ -95,8 +99,17 @@ module Issuable
end end
def create_milestone_note def create_milestone_note
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) SystemNoteService.change_milestone(issuable, issuable.project, current_user, issuable.milestone)
end end
end
def milestone_changes_tracking_enabled?
::Feature.enabled?(:track_resource_milestone_change_events, issuable.project)
end
def create_due_date_note def create_due_date_note
SystemNoteService.change_due_date(issuable, issuable.project, current_user, issuable.due_date) SystemNoteService.change_due_date(issuable, issuable.project, current_user, issuable.due_date)
......
# 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 ...@@ -9,6 +9,11 @@ module ResourceEvents
class MergeIntoNotesService class MergeIntoNotesService
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
SYNTHETIC_NOTE_BUILDER_SERVICES = [
SyntheticLabelNotesBuilderService,
SyntheticMilestoneNotesBuilderService
].freeze
attr_reader :resource, :current_user, :params attr_reader :resource, :current_user, :params
def initialize(resource, current_user, params = {}) def initialize(resource, current_user, params = {})
...@@ -24,7 +29,9 @@ module ResourceEvents ...@@ -24,7 +29,9 @@ module ResourceEvents
private private
def synthetic_notes 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 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 @@ ...@@ -48,14 +48,14 @@
- if todo.pending? - if todo.pending?
.todo-actions .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 Done
= icon('spinner spin') %span.spinner.ml-1
= 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 = 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 Undo
= icon('spinner spin') %span.spinner.ml-1
- else - else
.todo-actions .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 Add a To Do
= icon('spinner spin') %span.spinner.ml-1
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
.nav-controls .nav-controls
- if @todos.any?(&:pending?) - if @todos.any?(&:pending?)
.append-right-default .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 Mark all as done
= icon('spinner spin') %span.spinner.ml-1
= 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 = 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 Undo mark all as done
= icon('spinner spin') %span.spinner.ml-1
.todos-filters .todos-filters
.issues-details-filters.row-content-block.second-block .issues-details-filters.row-content-block.second-block
......
# frozen_string_literal: true # frozen_string_literal: true
class AdminEmailWorker class AdminEmailWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext # rubocop:disable Scalability/CronWorkerContext
# This worker does not perform work scoped to a context # This worker does not perform work scoped to a context
......
This diff is collapsed.
# frozen_string_literal: true # frozen_string_literal: true
class ArchiveTraceWorker class ArchiveTraceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include PipelineBackgroundQueue include PipelineBackgroundQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class AuthorizedProjectsWorker class AuthorizedProjectsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
prepend WaitableWorker prepend WaitableWorker
......
# frozen_string_literal: true # frozen_string_literal: true
module AutoDevops module AutoDevops
class DisableWorker class DisableWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include AutoDevopsQueue include AutoDevopsQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class AutoMergeProcessWorker class AutoMergeProcessWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
queue_namespace :auto_merge queue_namespace :auto_merge
......
# frozen_string_literal: true # frozen_string_literal: true
class BackgroundMigrationWorker class BackgroundMigrationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
feature_category_not_owned! feature_category_not_owned!
...@@ -22,6 +22,7 @@ class BackgroundMigrationWorker ...@@ -22,6 +22,7 @@ class BackgroundMigrationWorker
# class_name - The class name of the background migration to run. # class_name - The class name of the background migration to run.
# arguments - The arguments to pass to the migration class. # arguments - The arguments to pass to the migration class.
def perform(class_name, arguments = []) def perform(class_name, arguments = [])
with_context(caller_id: class_name.to_s) do
should_perform, ttl = perform_and_ttl(class_name) should_perform, ttl = perform_and_ttl(class_name)
if should_perform if should_perform
...@@ -35,6 +36,7 @@ class BackgroundMigrationWorker ...@@ -35,6 +36,7 @@ class BackgroundMigrationWorker
.perform_in(ttl || self.class.minimum_interval, class_name, arguments) .perform_in(ttl || self.class.minimum_interval, class_name, arguments)
end end
end end
end
def perform_and_ttl(class_name) def perform_and_ttl(class_name)
if always_perform? if always_perform?
......
# frozen_string_literal: true # frozen_string_literal: true
class BuildCoverageWorker class BuildCoverageWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include PipelineQueue include PipelineQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class BuildFinishedWorker class BuildFinishedWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include PipelineQueue include PipelineQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class BuildHooksWorker class BuildHooksWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include PipelineQueue include PipelineQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class BuildQueueWorker class BuildQueueWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include PipelineQueue include PipelineQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class BuildSuccessWorker class BuildSuccessWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include PipelineQueue include PipelineQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class BuildTraceSectionsWorker class BuildTraceSectionsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include PipelineQueue include PipelineQueue
......
# frozen_string_literal: true # frozen_string_literal: true
module Chaos module Chaos
class CpuSpinWorker class CpuSpinWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ChaosQueue include ChaosQueue
......
# frozen_string_literal: true # frozen_string_literal: true
module Chaos module Chaos
class DbSpinWorker class DbSpinWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ChaosQueue include ChaosQueue
......
# frozen_string_literal: true # frozen_string_literal: true
module Chaos module Chaos
class KillWorker class KillWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ChaosQueue include ChaosQueue
......
# frozen_string_literal: true # frozen_string_literal: true
module Chaos module Chaos
class LeakMemWorker class LeakMemWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ChaosQueue include ChaosQueue
......
# frozen_string_literal: true # frozen_string_literal: true
module Chaos module Chaos
class SleepWorker class SleepWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ChaosQueue include ChaosQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class ChatNotificationWorker class ChatNotificationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
TimeoutExceeded = Class.new(StandardError) TimeoutExceeded = Class.new(StandardError)
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class ArchiveTracesCronWorker class ArchiveTracesCronWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class BuildPrepareWorker class BuildPrepareWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include PipelineQueue include PipelineQueue
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class BuildScheduleWorker class BuildScheduleWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include PipelineQueue include PipelineQueue
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class BuildTraceChunkFlushWorker class BuildTraceChunkFlushWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include PipelineBackgroundQueue include PipelineBackgroundQueue
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class CreateCrossProjectPipelineWorker class CreateCrossProjectPipelineWorker # rubocop:disable Scalability/IdempotentWorker
include ::ApplicationWorker include ::ApplicationWorker
include ::PipelineQueue include ::PipelineQueue
......
# frozen_string_literal: true # frozen_string_literal: true
module Ci module Ci
class PipelineBridgeStatusWorker class PipelineBridgeStatusWorker # rubocop:disable Scalability/IdempotentWorker
include ::ApplicationWorker include ::ApplicationWorker
include ::PipelineQueue include ::PipelineQueue
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Ci module Ci
module ResourceGroups module ResourceGroups
class AssignResourceFromResourceGroupWorker class AssignResourceFromResourceGroupWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include PipelineQueue include PipelineQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class CleanupContainerRepositoryWorker class CleanupContainerRepositoryWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
queue_namespace :container_repository queue_namespace :container_repository
......
# frozen_string_literal: true # frozen_string_literal: true
class ClusterConfigureIstioWorker class ClusterConfigureIstioWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class ClusterConfigureWorker class ClusterConfigureWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class ClusterInstallAppWorker class ClusterInstallAppWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
include ClusterApplications include ClusterApplications
......
# frozen_string_literal: true # frozen_string_literal: true
class ClusterPatchAppWorker class ClusterPatchAppWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
include ClusterApplications include ClusterApplications
......
# frozen_string_literal: true # frozen_string_literal: true
class ClusterProjectConfigureWorker class ClusterProjectConfigureWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class ClusterProvisionWorker class ClusterProvisionWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class ClusterUpgradeAppWorker class ClusterUpgradeAppWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
include ClusterApplications include ClusterApplications
......
# frozen_string_literal: true # frozen_string_literal: true
class ClusterWaitForAppInstallationWorker class ClusterWaitForAppInstallationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
include ClusterApplications include ClusterApplications
......
# frozen_string_literal: true # frozen_string_literal: true
class ClusterWaitForIngressIpAddressWorker class ClusterWaitForIngressIpAddressWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
include ClusterApplications include ClusterApplications
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Applications module Applications
class ActivateServiceWorker class ActivateServiceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Applications module Applications
class DeactivateServiceWorker class DeactivateServiceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Applications module Applications
class UninstallWorker class UninstallWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
include ClusterApplications include ClusterApplications
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Applications module Applications
class WaitForUninstallAppWorker class WaitForUninstallAppWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
include ClusterApplications include ClusterApplications
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Cleanup module Cleanup
class AppWorker class AppWorker # rubocop:disable Scalability/IdempotentWorker
include ClusterCleanupMethods include ClusterCleanupMethods
def perform(cluster_id, execution_count = 0) def perform(cluster_id, execution_count = 0)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Cleanup module Cleanup
class ProjectNamespaceWorker class ProjectNamespaceWorker # rubocop:disable Scalability/IdempotentWorker
include ClusterCleanupMethods include ClusterCleanupMethods
def perform(cluster_id, execution_count = 0) def perform(cluster_id, execution_count = 0)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Clusters module Clusters
module Cleanup module Cleanup
class ServiceAccountWorker class ServiceAccountWorker # rubocop:disable Scalability/IdempotentWorker
include ClusterCleanupMethods include ClusterCleanupMethods
def perform(cluster_id) def perform(cluster_id)
......
...@@ -89,6 +89,14 @@ module WorkerAttributes ...@@ -89,6 +89,14 @@ module WorkerAttributes
worker_attributes[:resource_boundary] || :unknown worker_attributes[:resource_boundary] || :unknown
end end
def idempotent!
worker_attributes[:idempotent] = true
end
def idempotent?
worker_attributes[:idempotent]
end
def weight(value) def weight(value)
worker_attributes[:weight] = value worker_attributes[:weight] = value
end end
......
# frozen_string_literal: true # frozen_string_literal: true
class ContainerExpirationPolicyWorker class ContainerExpirationPolicyWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include CronjobQueue include CronjobQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class CreateCommitSignatureWorker class CreateCommitSignatureWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
feature_category :source_code_management feature_category :source_code_management
......
# frozen_string_literal: true # frozen_string_literal: true
class CreateEvidenceWorker class CreateEvidenceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
feature_category :release_governance feature_category :release_governance
......
# frozen_string_literal: true # frozen_string_literal: true
class CreateNoteDiffFileWorker class CreateNoteDiffFileWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
feature_category :source_code_management feature_category :source_code_management
......
# frozen_string_literal: true # frozen_string_literal: true
class CreatePipelineWorker class CreatePipelineWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include PipelineQueue include PipelineQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class DeleteContainerRepositoryWorker class DeleteContainerRepositoryWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ExclusiveLeaseGuard include ExclusiveLeaseGuard
......
# frozen_string_literal: true # frozen_string_literal: true
class DeleteDiffFilesWorker class DeleteDiffFilesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
feature_category :source_code_management feature_category :source_code_management
......
# frozen_string_literal: true # frozen_string_literal: true
class DeleteMergedBranchesWorker class DeleteMergedBranchesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
feature_category :source_code_management feature_category :source_code_management
......
# frozen_string_literal: true # frozen_string_literal: true
class DeleteStoredFilesWorker class DeleteStoredFilesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
feature_category_not_owned! feature_category_not_owned!
......
# frozen_string_literal: true # frozen_string_literal: true
class DeleteUserWorker class DeleteUserWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
feature_category :authentication_and_authorization feature_category :authentication_and_authorization
......
# frozen_string_literal: true # frozen_string_literal: true
module Deployments module Deployments
class FinishedWorker class FinishedWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
queue_namespace :deployment queue_namespace :deployment
......
# frozen_string_literal: true # frozen_string_literal: true
module Deployments module Deployments
class ForwardDeploymentWorker class ForwardDeploymentWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
queue_namespace :deployment queue_namespace :deployment
......
# frozen_string_literal: true # frozen_string_literal: true
module Deployments module Deployments
class SuccessWorker class SuccessWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
queue_namespace :deployment queue_namespace :deployment
......
# frozen_string_literal: true # frozen_string_literal: true
class DetectRepositoryLanguagesWorker class DetectRepositoryLanguagesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ExceptionBacktrace include ExceptionBacktrace
include ExclusiveLeaseGuard include ExclusiveLeaseGuard
......
# frozen_string_literal: true # frozen_string_literal: true
class EmailReceiverWorker class EmailReceiverWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
feature_category :issue_tracking feature_category :issue_tracking
......
# frozen_string_literal: true # frozen_string_literal: true
class EmailsOnPushWorker class EmailsOnPushWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
attr_reader :email, :skip_premailer attr_reader :email, :skip_premailer
......
# frozen_string_literal: true # frozen_string_literal: true
module Environments module Environments
class AutoStopCronWorker class AutoStopCronWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
# If a link to a different GitLab issue exists, a new link # If a link to a different GitLab issue exists, a new link
# will still be created, but will not be visible in Sentry # will still be created, but will not be visible in Sentry
# until the prior link is deleted. # until the prior link is deleted.
class ErrorTrackingIssueLinkWorker class ErrorTrackingIssueLinkWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include ExclusiveLeaseGuard include ExclusiveLeaseGuard
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
......
# frozen_string_literal: true # frozen_string_literal: true
class ExpireBuildArtifactsWorker class ExpireBuildArtifactsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
# rubocop:disable Scalability/CronWorkerContext # rubocop:disable Scalability/CronWorkerContext
# This worker does not perform work scoped to a context # This worker does not perform work scoped to a context
......
# frozen_string_literal: true # frozen_string_literal: true
class ExpireBuildInstanceArtifactsWorker class ExpireBuildInstanceArtifactsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
feature_category :continuous_integration feature_category :continuous_integration
......
...@@ -6,6 +6,7 @@ class ExpireJobCacheWorker ...@@ -6,6 +6,7 @@ class ExpireJobCacheWorker
queue_namespace :pipeline_cache queue_namespace :pipeline_cache
latency_sensitive_worker! latency_sensitive_worker!
idempotent!
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def perform(job_id) def perform(job_id)
......
# frozen_string_literal: true # frozen_string_literal: true
class ExpirePipelineCacheWorker class ExpirePipelineCacheWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include PipelineQueue include PipelineQueue
......
# frozen_string_literal: true # frozen_string_literal: true
class FileHookWorker class FileHookWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
sidekiq_options retry: false sidekiq_options retry: false
......
# frozen_string_literal: true # frozen_string_literal: true
class GitGarbageCollectWorker class GitGarbageCollectWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
sidekiq_options retry: false sidekiq_options retry: false
......
...@@ -6,7 +6,7 @@ module Gitlab ...@@ -6,7 +6,7 @@ module Gitlab
# number of jobs to complete, without blocking a thread. Once all jobs have # 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 # been completed this worker will advance the import process to the next
# stage. # stage.
class AdvanceStageWorker class AdvanceStageWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
sidekiq_options dead: false sidekiq_options dead: false
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Gitlab module Gitlab
module GithubImport module GithubImport
class ImportDiffNoteWorker class ImportDiffNoteWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter include ObjectImporter
def representation_class def representation_class
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Gitlab module Gitlab
module GithubImport module GithubImport
class ImportIssueWorker class ImportIssueWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter include ObjectImporter
def representation_class def representation_class
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Gitlab module Gitlab
module GithubImport module GithubImport
class ImportLfsObjectWorker class ImportLfsObjectWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter include ObjectImporter
def representation_class def representation_class
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Gitlab module Gitlab
module GithubImport module GithubImport
class ImportNoteWorker class ImportNoteWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter include ObjectImporter
def representation_class def representation_class
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Gitlab module Gitlab
module GithubImport module GithubImport
class ImportPullRequestWorker class ImportPullRequestWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter include ObjectImporter
def representation_class def representation_class
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Gitlab module Gitlab
module GithubImport module GithubImport
class RefreshImportJidWorker class RefreshImportJidWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include GithubImport::Queue include GithubImport::Queue
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module GithubImport module GithubImport
module Stage module Stage
class FinishImportWorker class FinishImportWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include GithubImport::Queue include GithubImport::Queue
include StageMethods include StageMethods
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module GithubImport module GithubImport
module Stage module Stage
class ImportBaseDataWorker class ImportBaseDataWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include GithubImport::Queue include GithubImport::Queue
include StageMethods include StageMethods
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module GithubImport module GithubImport
module Stage module Stage
class ImportIssuesAndDiffNotesWorker class ImportIssuesAndDiffNotesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include GithubImport::Queue include GithubImport::Queue
include StageMethods include StageMethods
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module GithubImport module GithubImport
module Stage module Stage
class ImportLfsObjectsWorker class ImportLfsObjectsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include GithubImport::Queue include GithubImport::Queue
include StageMethods include StageMethods
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module GithubImport module GithubImport
module Stage module Stage
class ImportNotesWorker class ImportNotesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include GithubImport::Queue include GithubImport::Queue
include StageMethods include StageMethods
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module GithubImport module GithubImport
module Stage module Stage
class ImportPullRequestsWorker class ImportPullRequestsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include GithubImport::Queue include GithubImport::Queue
include StageMethods include StageMethods
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module GithubImport module GithubImport
module Stage module Stage
class ImportRepositoryWorker class ImportRepositoryWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker include ApplicationWorker
include GithubImport::Queue include GithubImport::Queue
include StageMethods include StageMethods
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# - It marks the import as finished when all remaining jobs are done # - It marks the import as finished when all remaining jobs are done
module Gitlab module Gitlab
module PhabricatorImport module PhabricatorImport
class BaseWorker class BaseWorker # rubocop:disable Scalability/IdempotentWorker
include WorkerAttributes include WorkerAttributes
include Gitlab::ExclusiveLeaseHelpers include Gitlab::ExclusiveLeaseHelpers
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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