Skip to content

Ruby-SDK giving incorrect results #95

@abhimehta

Description

@abhimehta

#I have been getting different results when using the Ruby SDK.

System Info:
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin17]
Mac OS Sierra

java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

I have a user with key: tenant3 that was in variation = true.
I moved the user to be in variation = false for a feature-flag called "false"

However, I occasionally see true.

class LaunchDarklyTest

  def initialize
  end

  def testFlag
    user = {
      :key => "tenant3",
    }

    while true  do
      ld_client = LaunchDarkly::LDClient.new("sdk-afc32799-580f-4a97-9db7-24e6742b01c6")
      puts ld_client.variation("test", user, false)
    end
  end
end

LaunchDarklyTest.new.testFlag

Expected Result:

$ ruby ld.rb
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
true
false
false
true
false
false
true
false
true
true

Could you please help me understand if I am doing anything incorrectly or if this is an issue with ruby-sdk??

Doing the same thing using Java-SDK gives me accurate result

import com.launchdarkly.client.*;

public class LaunchDarkly {
    public static void main(String[] args) {
        LDClient ldClient = new LDClient("sdk-afc32799-580f-4a97-9db7-24e6742b01c6");
        LDUser user = new LDUser("tenant3");

        while (true) {
            boolean showFeature = ldClient.boolVariation("test", user, false);
            if (showFeature) {
                System.out.println("true");
            } else {
                System.out.println("false");
            }
        }

    }
}

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