-
Notifications
You must be signed in to change notification settings - Fork 55
Description
Versions
rails 5.2.1
ldclient 5.4.1
ruby 2.5.1
Implementation
initializers/launchdarkly.rb
require 'ldclient-rb'
$ld_client = LaunchDarkly::LDClient.new(ENV["LD_CLIENT_KEY"])
controllers/file_controller.rb
before_action do |controller|
is_feature_available("FEATURE_NAME")
end
def is_feature_available(code)
return true if $ld_client.variation(code, {:key => user.id}, false)
api_error(ERROR_MSG.disabled_feature, ApiMessage::ERROR_CODE_FORBIDDEN)
end
If the feature flag is off, the first time I ran this code, everything works fine and I get the expected error. If I reload the page, I get this error
On the other hand if the feature is on, I get this error in the first attempt.
If I add the code directly on a controller, lets say an index endpoint, I get the same issue.
I added a puts to show the result from the variation method, first time I run it I see this, which is great
If I reload I see this
As you can see the second screenshot doesn't show the ending stars *******, nd keeps there until I get a timed out error.
If I reload a third time, I get the segmentation error from the first screenshot.