Commit 5728180f authored by Alper Akgun's avatar Alper Akgun

Merge branch '292929-disable-scheduled-usage-ping-generation-in-com' into 'master'

Skip usage ping generation in GitLab.com

See merge request gitlab-org/gitlab!49845
parents 7e6a6e6b 3ad480c5
......@@ -13,6 +13,10 @@ class GitlabUsagePingWorker # rubocop:disable Scalability/IdempotentWorker
sidekiq_retry_in { |count| (count + 1) * 8.hours.to_i }
def perform
# Disable usage ping for GitLab.com
# See https://gitlab.com/gitlab-org/gitlab/-/issues/292929 for details
return if Gitlab.com?
# Multiple Sidekiq workers could run this. We should only do this at most once a day.
in_lock(LEASE_KEY, ttl: LEASE_TIMEOUT) do
# Splay the request over a minute to avoid thundering herd problems.
......
......@@ -8,6 +8,13 @@ RSpec.describe GitlabUsagePingWorker, :clean_gitlab_redis_shared_state do
allow(subject).to receive(:sleep)
end
it 'does not run for GitLab.com' do
allow(Gitlab).to receive(:com?).and_return(true)
expect(SubmitUsagePingService).not_to receive(:new)
subject.perform
end
it 'delegates to SubmitUsagePingService' do
expect_next_instance_of(SubmitUsagePingService) { |service| expect(service).to receive(:execute) }
......
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