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



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

def call(worker_class, msg, queue, redis_pool)
  msg['multi_tenant'] ||=
    {
      'class' => MultiTenant.current_tenant_class,
      'id' => MultiTenant.current_tenant_id
    } if MultiTenant.current_tenant.present?

  yield
end