Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
8db5a83725
commit
c10eac33ab
|
@ -83,3 +83,11 @@ export const billingPlanNames = {
|
|||
[billingPlans.PREMIUM]: s__('BillingPlans|Premium'),
|
||||
[billingPlans.ULTIMATE]: s__('BillingPlans|Ultimate'),
|
||||
};
|
||||
|
||||
const INTEGRATION_TYPE_SLACK = 'slack';
|
||||
const INTEGRATION_TYPE_MATTERMOST = 'mattermost';
|
||||
|
||||
export const placeholderForType = {
|
||||
[INTEGRATION_TYPE_SLACK]: __('#general, #development'),
|
||||
[INTEGRATION_TYPE_MATTERMOST]: __('my-channel'),
|
||||
};
|
||||
|
|
|
@ -1,17 +1,7 @@
|
|||
<script>
|
||||
import { GlFormGroup, GlFormCheckbox, GlFormInput } from '@gitlab/ui';
|
||||
import { mapGetters } from 'vuex';
|
||||
import { __ } from '~/locale';
|
||||
|
||||
const typeWithPlaceholder = {
|
||||
SLACK: 'slack',
|
||||
MATTERMOST: 'mattermost',
|
||||
};
|
||||
|
||||
const placeholderForType = {
|
||||
[typeWithPlaceholder.SLACK]: __('#general, #development'),
|
||||
[typeWithPlaceholder.MATTERMOST]: __('my-channel'),
|
||||
};
|
||||
import { placeholderForType } from 'jh_else_ce/integrations/constants';
|
||||
|
||||
export default {
|
||||
name: 'TriggerFields',
|
||||
|
|
|
@ -14,17 +14,6 @@ class AuthorizedProjectsWorker
|
|||
idempotent!
|
||||
loggable_arguments 1 # For the job waiter key
|
||||
|
||||
# This is a workaround for a Ruby 2.3.7 bug. rspec-mocks cannot restore the
|
||||
# visibility of prepended modules. See https://github.com/rspec/rspec-mocks/issues/1231
|
||||
# for more details.
|
||||
if Rails.env.test?
|
||||
def self.bulk_perform_and_wait(args_list, timeout: 10)
|
||||
end
|
||||
|
||||
def self.bulk_perform_inline(args_list)
|
||||
end
|
||||
end
|
||||
|
||||
def perform(user_id)
|
||||
user = User.find_by_id(user_id)
|
||||
|
||||
|
|
|
@ -5,27 +5,13 @@ module WaitableWorker
|
|||
|
||||
class_methods do
|
||||
# Schedules multiple jobs and waits for them to be completed.
|
||||
def bulk_perform_and_wait(args_list, timeout: 10)
|
||||
def bulk_perform_and_wait(args_list)
|
||||
# Short-circuit: it's more efficient to do small numbers of jobs inline
|
||||
if args_list.size == 1 || (args_list.size <= 3 && !inline_refresh_only_for_single_element?)
|
||||
return bulk_perform_inline(args_list)
|
||||
end
|
||||
|
||||
# Don't wait if there's too many jobs to be waited for. Not including the
|
||||
# waiter allows them to be deduplicated and it skips waiting for jobs that
|
||||
# are not likely to finish within the timeout. This assumes we can process
|
||||
# 10 jobs per second:
|
||||
# https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/205
|
||||
return bulk_perform_async(args_list) if (args_list.length >= 10 * timeout) || async_only_refresh?
|
||||
|
||||
waiter = Gitlab::JobWaiter.new(args_list.size, worker_label: self.to_s)
|
||||
|
||||
# Point all the bulk jobs at the same JobWaiter. Converts, [[1], [2], [3]]
|
||||
# into [[1, "key"], [2, "key"], [3, "key"]]
|
||||
waiting_args_list = args_list.map { |args| [*args, waiter.key] }
|
||||
bulk_perform_async(waiting_args_list)
|
||||
|
||||
waiter.wait(timeout)
|
||||
bulk_perform_async(args_list)
|
||||
end
|
||||
|
||||
# Performs multiple jobs directly. Failed jobs will be put into sidekiq so
|
||||
|
@ -44,10 +30,6 @@ module WaitableWorker
|
|||
bulk_perform_async(failed) if failed.present?
|
||||
end
|
||||
|
||||
def async_only_refresh?
|
||||
Feature.enabled?(:async_only_project_authorizations_refresh)
|
||||
end
|
||||
|
||||
def inline_refresh_only_for_single_element?
|
||||
Feature.enabled?(:inline_project_authorizations_refresh_only_for_single_element)
|
||||
end
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: async_only_project_authorizations_refresh
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90495
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/365585
|
||||
milestone: '15.2'
|
||||
type: development
|
||||
group: group::workspace
|
||||
default_enabled: false
|
|
@ -76,33 +76,12 @@ RSpec.describe WaitableWorker do
|
|||
end
|
||||
|
||||
context '>= 4 jobs' do
|
||||
it 'runs jobs using sidekiq and no waiter key' do
|
||||
it 'runs jobs using sidekiq' do
|
||||
arguments = 1.upto(5).map { |i| [i] }
|
||||
|
||||
expect(worker).to receive(:bulk_perform_async).with(arguments)
|
||||
|
||||
worker.bulk_perform_and_wait(arguments, timeout: 2)
|
||||
end
|
||||
|
||||
it 'runs > 10 * timeout jobs using sidekiq and no waiter key' do
|
||||
arguments = 1.upto(21).map { |i| [i] }
|
||||
|
||||
expect(worker).to receive(:bulk_perform_async).with(arguments)
|
||||
|
||||
worker.bulk_perform_and_wait(arguments, timeout: 2)
|
||||
end
|
||||
|
||||
context 'when the feature flag `async_only_project_authorizations_refresh` is turned off' do
|
||||
before do
|
||||
stub_feature_flags(async_only_project_authorizations_refresh: false)
|
||||
end
|
||||
|
||||
it 'runs > 3 jobs using sidekiq and a waiter key' do
|
||||
expect(worker).to receive(:bulk_perform_async)
|
||||
.with([[1, anything], [2, anything], [3, anything], [4, anything]])
|
||||
|
||||
worker.bulk_perform_and_wait([[1], [2], [3], [4]])
|
||||
end
|
||||
worker.bulk_perform_and_wait(arguments)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue