diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-06-05 09:18:12 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-06-05 09:18:12 +0000 |
commit | 3b39cf4e0c5d0ca680a40bb7232fee4f7fdfb02e (patch) | |
tree | ef2c85a93d787ca15ee857f1aa3754e58dbc163e /app/workers | |
parent | e90ca0f0fcae087f95b92a4699f884167b47eaaf (diff) | |
parent | d913ce176351094e2908344206a6136163fdfa89 (diff) | |
download | gitlab-ce-3b39cf4e0c5d0ca680a40bb7232fee4f7fdfb02e.tar.gz |
Merge branch '30469-convdev-index' into 'master'
ConvDev Index
Closes #30469
See merge request !11377
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/gitlab_usage_ping_worker.rb | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/app/workers/gitlab_usage_ping_worker.rb b/app/workers/gitlab_usage_ping_worker.rb index 2f02235b0ac..0a55aab63fd 100644 --- a/app/workers/gitlab_usage_ping_worker.rb +++ b/app/workers/gitlab_usage_ping_worker.rb @@ -3,29 +3,17 @@ class GitlabUsagePingWorker include Sidekiq::Worker include CronjobQueue - include HTTParty def perform - return unless current_application_settings.usage_ping_enabled - # Multiple Sidekiq workers could run this. We should only do this at most once a day. return unless try_obtain_lease - begin - HTTParty.post(url, - body: Gitlab::UsageData.to_json(force_refresh: true), - headers: { 'Content-type' => 'application/json' } - ) - rescue HTTParty::Error => e - Rails.logger.info "Unable to contact GitLab, Inc.: #{e}" - end + SubmitUsagePingService.new.execute end + private + def try_obtain_lease Gitlab::ExclusiveLease.new('gitlab_usage_ping_worker:ping', timeout: LEASE_TIMEOUT).try_obtain end - - def url - 'https://version.gitlab.com/usage_data' - end end |