Class: GitlabUsagePingWorker
- Inherits:
-
Object
- Object
- GitlabUsagePingWorker
- Defined in:
- app/workers/gitlab_usage_ping_worker.rb
Overview
rubocop:disable Scalability/IdempotentWorker
Constant Summary collapse
- LEASE_KEY =
'gitlab_usage_ping_worker:ping'
- LEASE_TIMEOUT =
86400
Constants included from Gitlab::ExclusiveLeaseHelpers
Gitlab::ExclusiveLeaseHelpers::FailedToObtainLockError
Constants included from ApplicationWorker
ApplicationWorker::LOGGING_EXTRA_KEY
Constants included from WorkerAttributes
WorkerAttributes::NAMESPACE_WEIGHTS, WorkerAttributes::VALID_RESOURCE_BOUNDARIES, WorkerAttributes::VALID_URGENCIES
Instance Method Summary collapse
Methods included from Gitlab::ExclusiveLeaseHelpers
Methods included from Gitlab::SidekiqVersioning::Worker
Methods included from WorkerContext
Instance Method Details
#perform ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/workers/gitlab_usage_ping_worker.rb', line 15 def perform # 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. sleep(rand(0.0..60.0).round(3)) SubmitUsagePingService.new.execute end end |