Class: Sidekiq::SetRequestAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/set_request_attributes.rb

Instance Method Summary collapse

Instance Method Details

#call(_worker, job, _queue, _redis_pool) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/sidekiq/set_request_attributes.rb', line 4

def call(_worker, job, _queue, _redis_pool)
  additional_request_attributes = RequestStore.store['additional_request_attributes'] || {}
  job['remote_ip'] = additional_request_attributes.fetch('remote_ip', 'N/A')
  job['user_agent'] = additional_request_attributes.fetch('user_agent', 'N/A')
  job['user_uuid'] = additional_request_attributes.fetch('user_uuid', 'N/A')
  job['source'] = additional_request_attributes.fetch('source') if additional_request_attributes['source']
  yield
end