Commit f05eea12 authored by Mark Chao's avatar Mark Chao

Merge branch 'remove-sidekiq-status-feature-flag' into 'master'

Remove opt_in_sidekiq_status feature flag

See merge request gitlab-org/gitlab!78279
parents 82d22da1 73166fc0
---
name: opt_in_sidekiq_status
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/77349
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/343964
milestone: '14.7'
type: development
group: group::scalability
default_enabled: false
...@@ -4,13 +4,7 @@ module Gitlab ...@@ -4,13 +4,7 @@ module Gitlab
module SidekiqStatus module SidekiqStatus
class ClientMiddleware class ClientMiddleware
def call(_, job, _, _) def call(_, job, _, _)
status_expiration = job['status_expiration'] Gitlab::SidekiqStatus.set(job['jid'], job['status_expiration'])
unless ::Feature.enabled?(:opt_in_sidekiq_status, default_enabled: :yaml)
status_expiration ||= Gitlab::SidekiqStatus::DEFAULT_EXPIRATION
end
Gitlab::SidekiqStatus.set(job['jid'], status_expiration)
yield yield
end end
......
# frozen_string_literal: true # frozen_string_literal: true
# This can use fast_spec_helper when the feature flag stubbing is removed. require 'fast_spec_helper'
require 'spec_helper'
RSpec.describe Gitlab::SidekiqStatus::ClientMiddleware, :clean_gitlab_redis_queues do RSpec.describe Gitlab::SidekiqStatus::ClientMiddleware, :clean_gitlab_redis_queues do
describe '#call' do describe '#call' do
context 'when opt_in_sidekiq_status is disabled' do context 'when the job has status_expiration set' do
before do it 'tracks the job in Redis' do
stub_feature_flags(opt_in_sidekiq_status: false) expect(Gitlab::SidekiqStatus).to receive(:set).with('123', 1.hour.to_i)
end
context 'when the job has status_expiration set' do
it 'tracks the job in Redis' do
expect(Gitlab::SidekiqStatus).to receive(:set).with('123', 1.hour.to_i).and_call_original
described_class.new
.call('Foo', { 'jid' => '123', 'status_expiration' => 1.hour.to_i }, double(:queue), double(:pool)) { nil }
expect(Gitlab::SidekiqStatus.num_running(['123'])).to eq(1)
end
end
context 'when the job does not have status_expiration set' do
it 'tracks the job in Redis' do
expect(Gitlab::SidekiqStatus).to receive(:set).with('123', 30.minutes.to_i).and_call_original
described_class.new
.call('Foo', { 'jid' => '123' }, double(:queue), double(:pool)) { nil }
expect(Gitlab::SidekiqStatus.num_running(['123'])).to eq(1) described_class.new
end .call('Foo', { 'jid' => '123', 'status_expiration' => 1.hour.to_i }, double(:queue), double(:pool)) { nil }
end end
end end
context 'when opt_in_sidekiq_status is enabled' do context 'when the job does not have status_expiration set' do
before do it 'does not track the job in Redis' do
stub_feature_flags(opt_in_sidekiq_status: true) expect(Gitlab::SidekiqStatus).to receive(:set).with('123', nil)
end
context 'when the job has status_expiration set' do
it 'tracks the job in Redis' do
expect(Gitlab::SidekiqStatus).to receive(:set).with('123', 1.hour.to_i).and_call_original
described_class.new
.call('Foo', { 'jid' => '123', 'status_expiration' => 1.hour.to_i }, double(:queue), double(:pool)) { nil }
expect(Gitlab::SidekiqStatus.num_running(['123'])).to eq(1)
end
end
context 'when the job does not have status_expiration set' do
it 'does not track the job in Redis' do
described_class.new
.call('Foo', { 'jid' => '123' }, double(:queue), double(:pool)) { nil }
expect(Gitlab::SidekiqStatus.num_running(['123'])).to be_zero described_class.new
end .call('Foo', { 'jid' => '123' }, double(:queue), double(:pool)) { nil }
end end
end 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