Skip to content
代码片段 群组 项目
未验证 提交 ac7b6214 编辑于 作者: Doug Stull's avatar Doug Stull 提交者: GitLab
浏览文件

Merge branch '441536-remove-ff-exclusive-lease' into 'master'

Remove FF `do_not_use_exclusive_lease_for_user_activity_service`

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/152168



Merged-by: default avatarDoug Stull <dstull@gitlab.com>
Approved-by: default avatarDoug Stull <dstull@gitlab.com>
Co-authored-by: default avatarManoj M J <mmj@gitlab.com>
No related branches found
No related tags found
无相关合并请求
......@@ -2,8 +2,6 @@
module Users
class ActivityService
LEASE_TIMEOUT = 1.minute.to_i
def initialize(author:, namespace: nil, project: nil)
@user = if author.respond_to?(:username)
author
......@@ -32,13 +30,6 @@ def record_activity
today = Date.today
return if user.last_activity_on == today
if Feature.disabled?(:do_not_use_exclusive_lease_for_user_activity_service, user)
lease = Gitlab::ExclusiveLease.new("activity_service:#{user.id}", timeout: LEASE_TIMEOUT)
# Skip transaction checks for exclusive lease as it is breaking system specs.
# See issue: https://gitlab.com/gitlab-org/gitlab/-/issues/441536
return unless Gitlab::ExclusiveLease.skipping_transaction_check { lease.try_obtain }
end
user.update_attribute(:last_activity_on, today)
Gitlab::UsageDataCounters::HLLRedisCounter.track_event('unique_active_user', values: user.id)
......
---
name: do_not_use_exclusive_lease_for_user_activity_service
feature_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/441536
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/151342
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/458719
milestone: '17.0'
group: group::tenant scale
type: gitlab_com_derisk
default_enabled: false
......@@ -3,8 +3,6 @@
require 'spec_helper'
RSpec.describe Users::ActivityService, feature_category: :user_profile do
include ExclusiveLeaseHelpers
let(:user) { create(:user, last_activity_on: last_activity_on) }
subject { described_class.new(author: user) }
......@@ -41,27 +39,6 @@
.to(Date.today)
end
context 'for ExclusiveLease' do
context 'when the feature flag `do_not_use_exclusive_lease_for_user_activity_service` is turned off' do
before do
stub_feature_flags(do_not_use_exclusive_lease_for_user_activity_service: false)
end
it 'tries to obtain ExclusiveLease' do
expect(Gitlab::ExclusiveLease).to receive(:new).with("activity_service:#{user.id}", anything)
.and_call_original
subject.execute
end
end
it 'does not try to obtain ExclusiveLease' do
expect(Gitlab::ExclusiveLease).not_to receive(:new).with("activity_service:#{user.id}", anything)
subject.execute
end
end
it 'tracks RedisHLL event' do
expect(Gitlab::UsageDataCounters::HLLRedisCounter)
.to receive(:track_event)
......@@ -105,12 +82,6 @@
let(:last_activity_on) { Date.today }
it_behaves_like 'does not update last_activity_on'
it 'does not try to obtain ExclusiveLease' do
expect(Gitlab::ExclusiveLease).not_to receive(:new).with("activity_service:#{user.id}", anything)
subject.execute
end
end
context 'when in GitLab read-only instance' do
......@@ -122,24 +93,6 @@
it_behaves_like 'does not update last_activity_on'
end
context 'for ExclusiveLease' do
context 'when the feature flag `do_not_use_exclusive_lease_for_user_activity_service` is turned off' do
before do
stub_feature_flags(do_not_use_exclusive_lease_for_user_activity_service: false)
end
context 'when a lease could not be obtained' do
let(:last_activity_on) { nil }
before do
stub_exclusive_lease_taken("activity_service:#{user.id}", timeout: 1.minute.to_i)
end
it_behaves_like 'does not update last_activity_on'
end
end
end
end
context 'with DB Load Balancing' do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册