Skip to content

Clarify SDK initialization instructions for rails applications #144

@ohsabry

Description

@ohsabry

The SDK documentation says that for a rails application, creating an instance of the client in an initializer, eg config/initializers/launchdarkly.rb:

https://docs.launchdarkly.com/docs/ruby-sdk-reference#section-initializing-ldclient-in-a-rails-application

However, it does then mention instructions for different servers like unicorn, puma, etc where reinitialises the client when a worker is forked

Similarly, with Unicorn, you'll need to specify an after_fork hook in your unicorn.rb config file:

after_fork do |server,worker|
  Rails.configuration.ld_client = LaunchDarkly::LDClient.new('SDK KEY')
end

Is it necessary to reinitialize the client on every worker fork? If so, why?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions