Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3ad480c5
Commit
3ad480c5
authored
Dec 14, 2020
by
alinamihaila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip usage ping generating in GitlabUsagePingWorker for GitLab.com
parent
b0d8e619
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
app/services/submit_usage_ping_service.rb
app/services/submit_usage_ping_service.rb
+0
-3
app/workers/gitlab_usage_ping_worker.rb
app/workers/gitlab_usage_ping_worker.rb
+4
-0
spec/services/submit_usage_ping_service_spec.rb
spec/services/submit_usage_ping_service_spec.rb
+0
-8
spec/workers/gitlab_usage_ping_worker_spec.rb
spec/workers/gitlab_usage_ping_worker_spec.rb
+7
-0
No files found.
app/services/submit_usage_ping_service.rb
View file @
3ad480c5
...
...
@@ -17,9 +17,6 @@ class SubmitUsagePingService
SubmissionError
=
Class
.
new
(
StandardError
)
def
execute
# Disable usage ping for GitLab.com
# See https://gitlab.com/gitlab-org/gitlab/-/issues/292929 for details
return
if
Gitlab
.
com?
return
unless
Gitlab
::
CurrentSettings
.
usage_ping_enabled?
return
if
User
.
single_user
&
.
requires_usage_stats_consent?
...
...
app/workers/gitlab_usage_ping_worker.rb
View file @
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.
...
...
spec/services/submit_usage_ping_service_spec.rb
View file @
3ad480c5
...
...
@@ -80,14 +80,6 @@ RSpec.describe SubmitUsagePingService do
end
end
context
'when GitLab.com'
do
before
do
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
end
it_behaves_like
'does not run'
end
context
'when usage ping is disabled'
do
before
do
stub_application_setting
(
usage_ping_enabled:
false
)
...
...
spec/workers/gitlab_usage_ping_worker_spec.rb
View file @
3ad480c5
...
...
@@ -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
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment