Class: Sidekiq::Middleware::MultiTenant::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord-multi-tenant/sidekiq.rb

Overview

Get the current tenant and store in the message to be sent to Sidekiq.

Instance Method Summary collapse

Instance Method Details

#call(_worker_class, msg, _queue, _redis_pool) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/activerecord-multi-tenant/sidekiq.rb', line 7

def call(_worker_class, msg, _queue, _redis_pool)
  if MultiTenant.current_tenant.present?
    msg['multi_tenant'] ||=
      {
        'class' => MultiTenant.current_tenant_class,
        'id' => MultiTenant.current_tenant_id
      }
  end

  yield
end