Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client fails to receive updates in Rails console if Spring is enabled #73

Closed
jkodumal opened this issue Sep 15, 2016 · 6 comments
Closed

Comments

@jkodumal
Copy link
Contributor

If Spring is enabled, the LaunchDarkly client does not receive feature flag updates in the rails console. A workaround is to disable Spring:

DISABLE_SPRING=true rails console

@justinucd
Copy link

Update: To use LaunchDarkly with the Rails application preloader Spring, we recommend using an after_fork callback in the config/spring.rb file.

Code example and documentation

@robwise
Copy link

robwise commented Jan 27, 2017

@justinucd If we are using both Spring and Puma with our Rails app, which method should we use (Puma after_boot or Spring after_fork)?

@markedmondson
Copy link

@robwise you should be good in the Spring#after_fork

@justinucd
Copy link

Thanks @markedmondson ! @robwise let me know if this works for you - if not, we can look into it further

@robwise
Copy link

robwise commented Jan 27, 2017

So do I have to put some sort of conditional in there based on the environment? Because we don't run spring in production, just when running our test suites, so launchdarkly would never get initialized in those cases. So do I also start it via Puma as well?

@markedmondson
Copy link

markedmondson commented Jan 27, 2017

Semi-pseudo code:

LaunchDarklyInitializer = lambda do
  LaunchDarkly::LDClient.new(...)
end

if defined?(Spring)
  Spring.after_fork do
    LaunchDarklyInitializer.call
  end
else
  LaunchDarklyInitializer.call
end

eli-darkly added a commit that referenced this issue Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants