diff options
author | Taurie Davis, Simon Knox and Adam Niedzielski <awesome@gitlab.com> | 2017-05-24 12:25:44 +0200 |
---|---|---|
committer | Adam Niedzielski <adamsunday@gmail.com> | 2017-06-01 17:37:21 +0200 |
commit | 26dde5f55f1dac2e6bea4f7e1dfa51c72dc756cb (patch) | |
tree | f0168cb9ad0be7c4bf8657a5321e5da0bda8e83b /app/workers | |
parent | c72abcefe79dd906cbbf0088b442a8979e9fc746 (diff) | |
download | gitlab-ce-26dde5f55f1dac2e6bea4f7e1dfa51c72dc756cb.tar.gz |
Add Conversational Development Index page to admin panel
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 |