Skip to content

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

Closed

Description

@jkodumal

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

Activity

  1. justinucd commented on Nov 1, 2016

    @justinucd

    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

  2. robwise commented on Jan 27, 2017

    @robwise

    @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)?

  3. markedmondson commented on Jan 27, 2017

    @markedmondson

    @robwise you should be good in the Spring#after_fork

  4. justinucd commented on Jan 27, 2017

    @justinucd

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

  5. robwise commented on Jan 27, 2017

    @robwise

    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?

  6. markedmondson commented on Jan 27, 2017

    @markedmondson

    Semi-pseudo code:

    LaunchDarklyInitializer = lambda do
      LaunchDarkly::LDClient.new(...)
    end
    
    if defined?(Spring)
      Spring.after_fork do
        LaunchDarklyInitializer.call
      end
    else
      LaunchDarklyInitializer.call
    end
    
  7. added a commit that references this issue on Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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