Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-02-19 18:09:10 +00:00
parent c7e385e282
commit 33795139ea
232 changed files with 1564 additions and 277 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -371,8 +371,11 @@
}
.btn-loading {
&:not(.disabled) .fa {
display: none;
&:not(.disabled) {
.fa,
.spinner {
display: none;
}
}
.fa {

View File

@ -0,0 +1,9 @@
# frozen_string_literal: true
module MilestoneEventable
extend ActiveSupport::Concern
included do
has_many :resource_milestone_events
end
end

View File

@ -0,0 +1,31 @@
# 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

View File

@ -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

View File

@ -18,6 +18,7 @@ class MergeRequest < ApplicationRecord
include DeprecatedAssignee
include ShaAttribute
include IgnorableColumns
include MilestoneEventable
sha_attribute :squash_commit_sha

View File

@ -0,0 +1,49 @@
# 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

View File

@ -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

View File

@ -0,0 +1,30 @@
# 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

View File

@ -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|

View File

@ -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

View File

@ -0,0 +1,50 @@
# 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

View File

@ -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

View File

@ -0,0 +1,31 @@
# 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

View File

@ -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

View File

@ -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

View File

@ -1,6 +1,6 @@
# 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

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ArchiveTraceWorker
class ArchiveTraceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineBackgroundQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AuthorizedProjectsWorker
class AuthorizedProjectsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
prepend WaitableWorker

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module AutoDevops
class DisableWorker
class DisableWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include AutoDevopsQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class AutoMergeProcessWorker
class AutoMergeProcessWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :auto_merge

View File

@ -1,6 +1,6 @@
# 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

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class BuildCoverageWorker
class BuildCoverageWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class BuildFinishedWorker
class BuildFinishedWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class BuildHooksWorker
class BuildHooksWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class BuildQueueWorker
class BuildQueueWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class BuildSuccessWorker
class BuildSuccessWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class BuildTraceSectionsWorker
class BuildTraceSectionsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Chaos
class CpuSpinWorker
class CpuSpinWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ChaosQueue

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Chaos
class DbSpinWorker
class DbSpinWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ChaosQueue

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Chaos
class KillWorker
class KillWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ChaosQueue

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Chaos
class LeakMemWorker
class LeakMemWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ChaosQueue

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Chaos
class SleepWorker
class SleepWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ChaosQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ChatNotificationWorker
class ChatNotificationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
TimeoutExceeded = Class.new(StandardError)

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Ci
class ArchiveTracesCronWorker
class ArchiveTracesCronWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Ci
class BuildPrepareWorker
class BuildPrepareWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Ci
class BuildScheduleWorker
class BuildScheduleWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Ci
class BuildTraceChunkFlushWorker
class BuildTraceChunkFlushWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineBackgroundQueue

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Ci
class CreateCrossProjectPipelineWorker
class CreateCrossProjectPipelineWorker # rubocop:disable Scalability/IdempotentWorker
include ::ApplicationWorker
include ::PipelineQueue

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Ci
class PipelineBridgeStatusWorker
class PipelineBridgeStatusWorker # rubocop:disable Scalability/IdempotentWorker
include ::ApplicationWorker
include ::PipelineQueue

View File

@ -2,7 +2,7 @@
module Ci
module ResourceGroups
class AssignResourceFromResourceGroupWorker
class AssignResourceFromResourceGroupWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CleanupContainerRepositoryWorker
class CleanupContainerRepositoryWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :container_repository

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ClusterConfigureIstioWorker
class ClusterConfigureIstioWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ClusterConfigureWorker
class ClusterConfigureWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ClusterInstallAppWorker
class ClusterInstallAppWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ClusterPatchAppWorker
class ClusterPatchAppWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ClusterProjectConfigureWorker
class ClusterProjectConfigureWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ClusterProvisionWorker
class ClusterProvisionWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ClusterUpgradeAppWorker
class ClusterUpgradeAppWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ClusterWaitForAppInstallationWorker
class ClusterWaitForAppInstallationWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ClusterWaitForIngressIpAddressWorker
class ClusterWaitForIngressIpAddressWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications

View File

@ -2,7 +2,7 @@
module Clusters
module Applications
class ActivateServiceWorker
class ActivateServiceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue

View File

@ -2,7 +2,7 @@
module Clusters
module Applications
class DeactivateServiceWorker
class DeactivateServiceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue

View File

@ -2,7 +2,7 @@
module Clusters
module Applications
class UninstallWorker
class UninstallWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications

View File

@ -2,7 +2,7 @@
module Clusters
module Applications
class WaitForUninstallAppWorker
class WaitForUninstallAppWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ClusterQueue
include ClusterApplications

View File

@ -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)

View File

@ -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)

View File

@ -2,7 +2,7 @@
module Clusters
module Cleanup
class ServiceAccountWorker
class ServiceAccountWorker # rubocop:disable Scalability/IdempotentWorker
include ClusterCleanupMethods
def perform(cluster_id)

View File

@ -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

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ContainerExpirationPolicyWorker
class ContainerExpirationPolicyWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreateCommitSignatureWorker
class CreateCommitSignatureWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreateEvidenceWorker
class CreateEvidenceWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :release_governance

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreateNoteDiffFileWorker
class CreateNoteDiffFileWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class CreatePipelineWorker
class CreatePipelineWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class DeleteContainerRepositoryWorker
class DeleteContainerRepositoryWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExclusiveLeaseGuard

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class DeleteDiffFilesWorker
class DeleteDiffFilesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class DeleteMergedBranchesWorker
class DeleteMergedBranchesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :source_code_management

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class DeleteStoredFilesWorker
class DeleteStoredFilesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category_not_owned!

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class DeleteUserWorker
class DeleteUserWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :authentication_and_authorization

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Deployments
class FinishedWorker
class FinishedWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :deployment

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Deployments
class ForwardDeploymentWorker
class ForwardDeploymentWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :deployment

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Deployments
class SuccessWorker
class SuccessWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
queue_namespace :deployment

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class DetectRepositoryLanguagesWorker
class DetectRepositoryLanguagesWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include ExceptionBacktrace
include ExclusiveLeaseGuard

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class EmailReceiverWorker
class EmailReceiverWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :issue_tracking

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class EmailsOnPushWorker
class EmailsOnPushWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
attr_reader :email, :skip_premailer

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
module Environments
class AutoStopCronWorker
class AutoStopCronWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext

View File

@ -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

View File

@ -1,6 +1,6 @@
# 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

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ExpireBuildInstanceArtifactsWorker
class ExpireBuildInstanceArtifactsWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :continuous_integration

View File

@ -6,6 +6,7 @@ class ExpireJobCacheWorker
queue_namespace :pipeline_cache
latency_sensitive_worker!
idempotent!
# rubocop: disable CodeReuse/ActiveRecord
def perform(job_id)

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class ExpirePipelineCacheWorker
class ExpirePipelineCacheWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include PipelineQueue

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class FileHookWorker
class FileHookWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
sidekiq_options retry: false

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class GitGarbageCollectWorker
class GitGarbageCollectWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
sidekiq_options retry: false

View File

@ -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

View File

@ -2,7 +2,7 @@
module Gitlab
module GithubImport
class ImportDiffNoteWorker
class ImportDiffNoteWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter
def representation_class

View File

@ -2,7 +2,7 @@
module Gitlab
module GithubImport
class ImportIssueWorker
class ImportIssueWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter
def representation_class

View File

@ -2,7 +2,7 @@
module Gitlab
module GithubImport
class ImportLfsObjectWorker
class ImportLfsObjectWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter
def representation_class

View File

@ -2,7 +2,7 @@
module Gitlab
module GithubImport
class ImportNoteWorker
class ImportNoteWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter
def representation_class

View File

@ -2,7 +2,7 @@
module Gitlab
module GithubImport
class ImportPullRequestWorker
class ImportPullRequestWorker # rubocop:disable Scalability/IdempotentWorker
include ObjectImporter
def representation_class

View File

@ -2,7 +2,7 @@
module Gitlab
module GithubImport
class RefreshImportJidWorker
class RefreshImportJidWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
include GithubImport::Queue

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More