From bae1a709e0f3fa3a316197c8afa94b956e2d6d95 Mon Sep 17 00:00:00 2001 From: Matias Melograno Date: Tue, 24 Oct 2023 13:26:34 -0300 Subject: [PATCH 1/4] forwarding predis options directly without wrapping it --- .../Cache/Storage/Adapter/PRedis.php | 91 +---- src/SplitIO/Sdk.php | 4 - tests/Suite/Adapter/RedisAdapterTest.php | 313 ++---------------- 3 files changed, 30 insertions(+), 378 deletions(-) diff --git a/src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php b/src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php index a78bf537..0f12bb81 100644 --- a/src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php +++ b/src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php @@ -3,7 +3,6 @@ use SplitIO\Component\Cache\Storage\Exception\AdapterException; use SplitIO\Component\Utils as SplitIOUtils; -use SplitIO\Component\Common\Context; /** * Class PRedis @@ -26,7 +25,7 @@ public function __construct(array $options) } $_redisConfig = $this->getRedisConfiguration($options); - $this->client = new \Predis\Client($_redisConfig['redis'], $_redisConfig['options']); + $this->client = new \Predis\Client($_redisConfig['parameters'], $_redisConfig['options']); } /** @@ -48,24 +47,6 @@ private function isValidConfigArray($nodes, $type) return null; } - /** - * @param array $sentinels - * @param array $options - * @return bool - * @throws AdapterException - */ - private function isValidSentinelConfig($sentinels, $options) - { - $msg = $this->isValidConfigArray($sentinels, 'sentinel'); - if (!is_null($msg)) { - throw new AdapterException($msg); - } - if (!isset($options['service'])) { - throw new AdapterException('Master name is required in replication mode for sentinel.'); - } - return true; - } - private function validateKeyHashTag($keyHashTag) { if (!is_string($keyHashTag)) { @@ -121,83 +102,32 @@ function ($value) { if (empty($filteredArray)) { throw new AdapterException('keyHashTags size is zero after filtering valid elements.'); } - return $selected = $filteredArray[array_rand($filteredArray, 1)]; + return $filteredArray[array_rand($filteredArray, 1)]; } - /** - * @param array $clusters - * @return bool - * @throws AdapterException - */ - private function isValidClusterConfig($clusters) - { - $msg = $this->isValidConfigArray($clusters, 'clusterNode'); - if (!is_null($msg)) { - throw new AdapterException($msg); - } - return true; - } - /** * @param mixed $options * @return array - * @throws AdapterException */ private function getRedisConfiguration($options) { $redisConfigutation = array( - 'redis' => null, - 'options' => null + 'parameters' => (isset($options['parameters'])) ? $options['parameters'] : null, + 'options' => null, ); - $parameters = (isset($options['parameters'])) ? $options['parameters'] : null; - $sentinels = (isset($options['sentinels'])) ? $options['sentinels'] : null; - $clusters = (isset($options['clusterNodes'])) ? $options['clusterNodes'] : null; $_options = (isset($options['options'])) ? $options['options'] : null; - - if (isset($_options['distributedStrategy']) && isset($parameters['tls'])) { - throw new AdapterException("SSL/TLS cannot be used together with sentinel/cluster yet"); - } - if ($_options && isset($_options['prefix'])) { $_options['prefix'] = self::normalizePrefix($_options['prefix']); } - if (isset($parameters)) { - $redisConfigutation['redis'] = $parameters; - } else { - // @TODO remove this statement when replication will be deprecated - if (isset($_options['replication'])) { - Context::getLogger()->warning("'replication' option was deprecated please use 'distributedStrategy'"); - if (!isset($_options['distributedStrategy'])) { - $_options['distributedStrategy'] = $_options['replication']; - } - } - if (isset($_options['distributedStrategy'])) { - switch ($_options['distributedStrategy']) { - case 'cluster': - if ($this->isValidClusterConfig($clusters)) { - $keyHashTag = $this->selectKeyHashTag($_options); - $_options['cluster'] = 'redis'; - $redisConfigutation['redis'] = $clusters; - $prefix = isset($_options['prefix']) ? $_options['prefix'] : ''; - $_options['prefix'] = $keyHashTag . $prefix; - } - break; - case 'sentinel': - if ($this->isValidSentinelConfig($sentinels, $_options)) { - $_options['replication'] = 'sentinel'; - $redisConfigutation['redis'] = $sentinels; - } - break; - default: - throw new AdapterException("Wrong configuration of redis 'distributedStrategy'."); - } - } else { - throw new AdapterException("Wrong configuration of redis."); - } + if (isset($_options['cluster'])) { + $keyHashTag = $this->selectKeyHashTag($_options); + $prefix = isset($_options['prefix']) ? $_options['prefix'] : ''; + $_options['prefix'] = $keyHashTag . $prefix; } + $redisConfigutation['options'] = $_options; return $redisConfigutation; } @@ -254,8 +184,7 @@ public function getKeys($pattern = '*') $prefix = $this->client->getOptions()->__get("prefix")->getPrefix(); } - if ($this->client->getOptions()->__isset("distributedStrategy") && - $this->client->getOptions()->__get("distributedStrategy") == "cluster") { + if ($this->client->getOptions()->__isset("cluster")) { $keys = array(); foreach ($this->client as $nodeClient) { $nodeClientKeys = $nodeClient->keys($pattern); diff --git a/src/SplitIO/Sdk.php b/src/SplitIO/Sdk.php index d62eeb3b..f498cc31 100644 --- a/src/SplitIO/Sdk.php +++ b/src/SplitIO/Sdk.php @@ -67,10 +67,6 @@ private static function configureCache(array $options) } elseif ($cacheAdapter == 'predis') { $_options['options'] = isset($options['options']) ? $options['options'] : null; $_options['parameters'] = isset($options['parameters']) ? $options['parameters'] : null; - $_options['sentinels'] = isset($options['sentinels']) ? $options['sentinels'] : null; - $_options['clusterNodes'] = isset($options['clusterNodes']) ? $options['clusterNodes'] : null; - $_options['distributedStrategy'] = isset($options['distributedStrategy']) - ? $options['distributedStrategy'] : null; } else { throw new Exception("A valid cache system is required. Given: $cacheAdapter"); } diff --git a/tests/Suite/Adapter/RedisAdapterTest.php b/tests/Suite/Adapter/RedisAdapterTest.php index e8b37fb2..c0e4b893 100644 --- a/tests/Suite/Adapter/RedisAdapterTest.php +++ b/tests/Suite/Adapter/RedisAdapterTest.php @@ -22,14 +22,6 @@ private function getMockedLogger() return $logger; } - public function testRedisWithNullValues() - { - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException'); - $this->expectExceptionMessage("Wrong configuration of redis."); - - $predis = new PRedis(array()); - } - public function testRedisWithOnlyParameters() { $predis = new PRedis(array( @@ -79,233 +71,6 @@ public function testRedisWithParametersAndPrefix() $predisClient->del('test-redis-assertion.this_is_a_test_key'); } - public function testRedisWithParametersPrefixAndSentinels() - { - $predis = new PRedis(array( - 'parameters' => array( - 'scheme' => 'tcp', - 'host' => 'localhost', - 'port' => 6379, - 'timeout' => 881, - 'database' => 0 - ), - 'sentinels' => array('something', 'other'), - 'options' => array( - 'prefix' => 'test-redis-assertion' - ) - )); - $predisClient = new \Predis\Client([ - 'host' => REDIS_HOST, - 'port' => REDIS_PORT, - ]); - $predisClient->set('test-redis-assertion.this_is_a_test_key', 'this-is-a-test-value'); - - $value = $predis->get('this_is_a_test_key'); - $this->assertEquals('this-is-a-test-value', $value); - - $predisClient->del('test-redis-assertion.this_is_a_test_key'); - } - - public function testRedisWithEmptySentinels() - { - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException'); - $this->expectExceptionMessage('At least one sentinel is required.'); - - $predis = new PRedis(array( - 'sentinels' => array(), - 'options' => array( - 'distributedStrategy' => 'sentinel' - ) - )); - } - - public function testRedisWithSentinelsWithoutOptions() - { - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException'); - $this->expectExceptionMessage("Wrong configuration of redis."); - - $predis = new PRedis(array( - 'sentinels' => array( - '127.0.0.1' - ), - )); - } - - public function testRedisWithSentinelsWithoutReplicationOption() - { - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException', ); - $this->expectExceptionMessage("Wrong configuration of redis."); - - $predis = new PRedis(array( - 'sentinels' => array( - '127.0.0.1' - ), - 'options' => array() - )); - } - - public function testRedisWithSentinelsWithWrongReplicationOption() - { - $logger = $this->getMockedLogger(); - $logger->expects($this->once()) - ->method('warning') - ->with($this->equalTo("'replication' option was deprecated please use 'distributedStrategy'")); - - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException'); - $this->expectExceptionMessage("Wrong configuration of redis 'distributedStrategy'."); - - $predis = new PRedis(array( - 'sentinels' => array( - '127.0.0.1' - ), - 'options' => array( - 'replication' => 'test' - ) - )); - } - - public function testRedisWithSentinelsWithoutServiceOption() - { - $logger = $this->getMockedLogger(); - $logger->expects($this->once()) - ->method('warning') - ->with($this->equalTo("'replication' option was deprecated please use 'distributedStrategy'")); - - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException'); - $this->expectExceptionMessage('Master name is required in replication mode for sentinel.'); - - $predis = new PRedis(array( - 'sentinels' => array( - '127.0.0.1' - ), - 'options' => array( - 'replication' => 'sentinel' - ) - )); - } - - public function testRedisWithWrongTypeOfSentinels() - { - $logger = $this->getMockedLogger(); - - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException',); - $this->expectExceptionMessage('sentinels must be an array.'); - - $predis = new PRedis(array( - 'sentinels' => "test", - 'options' => array( - 'replication' => 'sentinel' - ) - )); - } - - public function testRedisSentinelWithWrongRedisDistributedStrategy() - { - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException'); - $this->expectExceptionMessage("Wrong configuration of redis 'distributedStrategy'."); - - $predis = new PRedis(array( - 'sentinels' => array( - '127.0.0.1' - ), - 'options' => array( - 'distributedStrategy' => 'test' - ) - )); - } - - public function testRedisWithSentinels() - { - $logger = $this->getMockedLogger(); - $logger->expects($this->once()) - ->method('warning') - ->with($this->equalTo("'replication' option was deprecated please use 'distributedStrategy'")); - - $this->expectException('\Predis\ClientException'); - $predis = new PRedis(array( - 'sentinels' => array( - 'tcp://MYIP:26379?timeout=3' - ), - 'options' => array( - 'replication' => 'sentinel', - 'service' => 'master' - ) - )); - - $predis->get('this_is_a_test_key'); - } - - public function testRedisWithSentinelsAndDistributedStrategy() - { - $this->expectException('\Predis\Response\ServerException'); - $predis = new PRedis(array( - 'sentinels' => array( - 'tcp:/MYIP:26379?timeout=3' - ), - 'options' => array( - 'service' => 'master', - 'distributedStrategy' => 'sentinel' - ) - )); - - $predis->get('this_is_a_test_key'); - } - - public function testRedisWithEmptyClusters() - { - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException'); - $this->expectExceptionMessage('At least one clusterNode is required.'); - - $predis = new PRedis(array( - 'clusterNodes' => array(), - 'options' => array( - 'distributedStrategy' => 'cluster', - 'keyHashTag' => '{TEST}' - ) - )); - } - - public function testRedisWithClustersWithoutOptions() - { - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException'); - $this->expectExceptionMessage("Wrong configuration of redis."); - - $predis = new PRedis(array( - 'clusterNodes' => array( - '127.0.0.1' - ), - )); - } - - public function testRedisWithWrongTypeOfClusters() - { - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException'); - $this->expectExceptionMessage('clusterNodes must be an array.'); - - $predis = new PRedis(array( - 'clusterNodes' => "test", - 'options' => array( - 'distributedStrategy' => 'cluster', - 'keyHashTag' => '{TEST}' - ) - )); - } - - public function testRedisClusterWithWrongRedisDistributedStrategy() - { - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException'); - $this->expectExceptionMessage("Wrong configuration of redis 'distributedStrategy'."); - - $predis = new PRedis(array( - 'clusterNodes' => array( - '127.0.0.1' - ), - 'options' => array( - 'distributedStrategy' => 'test' - ) - )); - } - public function testRedisWithInvalidKeyHashtagInClusters() { $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException'); @@ -316,7 +81,7 @@ public function testRedisWithInvalidKeyHashtagInClusters() 'tcp://MYIP:26379?timeout=3' ), 'options' => array( - 'distributedStrategy' => 'cluster', + 'cluster' => 'predis', 'keyHashTag' => '{TEST' ) )); @@ -334,7 +99,7 @@ public function testRedisWithInvalidBeginingKeyHashtagInClusters() 'tcp://MYIP:26379?timeout=3' ), 'options' => array( - 'distributedStrategy' => 'cluster', + 'cluster' => 'redis', 'keyHashTag' => 'TEST}' ) )); @@ -352,7 +117,7 @@ public function testRedisWithWrongTypeKeyHashtagInClusters() 'tcp://MYIP:26379?timeout=3' ), 'options' => array( - 'distributedStrategy' => 'cluster', + 'cluster' => 'predis', 'keyHashTag' => array() ) )); @@ -370,7 +135,7 @@ public function testRedisWithWrongLengthKeyHashtagInClusters() 'tcp://MYIP:26379?timeout=3' ), 'options' => array( - 'distributedStrategy' => 'cluster', + 'cluster' => 'predis', 'keyHashTag' => "{}" ) )); @@ -380,15 +145,13 @@ public function testRedisWithWrongLengthKeyHashtagInClusters() public function testRedisWithClusters() { - $this->expectException('\Predis\ClientException'); + $this->expectException('\Predis\Connection\ConnectionException'); $predis = new PRedis(array( - 'clusterNodes' => array( - 'tcp://MYIP:26379?timeout=3' - ), + 'parameters' => ['tcp://10.0.0.1', 'tcp://10.0.0.2', 'tcp://10.0.0.3'], 'options' => array( - 'distributedStrategy' => 'cluster', + 'cluster' => 'predis', 'keyHashTag' => '{TEST}' - ) + ), )); $predis->get('this_is_a_test_key'); @@ -396,13 +159,11 @@ public function testRedisWithClusters() public function testRedisWithoutCustomKeyHashtagClusters() { - $this->expectException('\Predis\ClientException'); + $this->expectException('\Predis\Connection\ConnectionException'); $predis = new PRedis(array( - 'clusterNodes' => array( - 'tcp://MYIP:26379?timeout=3' - ), + 'parameters' => ['tcp://10.0.0.1', 'tcp://10.0.0.2', 'tcp://10.0.0.3'], 'options' => array( - 'distributedStrategy' => 'cluster', + 'cluster' => 'predis', ) )); @@ -415,11 +176,9 @@ public function testRedisWithClustersKeyHashTags() $this->expectExceptionMessage("keyHashTags must be an array."); $predis = new PRedis(array( - 'clusterNodes' => array( - 'tcp://MYIP:26379?timeout=3' - ), + 'parameters' => ['tcp://10.0.0.1', 'tcp://10.0.0.2', 'tcp://10.0.0.3'], 'options' => array( - 'distributedStrategy' => 'cluster', + 'cluster' => 'predis', 'keyHashTags' => '{TEST}' ) )); @@ -433,11 +192,9 @@ public function testRedisWithClustersKeyHashTagsInvalid() $this->expectExceptionMessage("keyHashTags size is zero after filtering valid elements."); $predis = new PRedis(array( - 'clusterNodes' => array( - 'tcp://MYIP:26379?timeout=3' - ), + 'parameters' => ['tcp://10.0.0.1', 'tcp://10.0.0.2', 'tcp://10.0.0.3'], 'options' => array( - 'distributedStrategy' => 'cluster', + 'cluster' => 'predis', 'keyHashTags' => array(1, 2) ) )); @@ -451,11 +208,9 @@ public function testRedisWithClustersKeyHashTagsInvalidHashTags() $this->expectExceptionMessage("keyHashTags size is zero after filtering valid elements."); $predis = new PRedis(array( - 'clusterNodes' => array( - 'tcp://MYIP:26379?timeout=3' - ), + 'parameters' => ['tcp://10.0.0.1', 'tcp://10.0.0.2', 'tcp://10.0.0.3'], 'options' => array( - 'distributedStrategy' => 'cluster', + 'cluster' => 'predis', 'keyHashTags' => array("one", "two", "three") ) )); @@ -465,13 +220,11 @@ public function testRedisWithClustersKeyHashTagsInvalidHashTags() public function testRedisWithClustersKeyHashTagsValid() { - $this->expectException('\Predis\ClientException'); + $this->expectException('\Predis\Connection\ConnectionException'); $predis = new PRedis(array( - 'clusterNodes' => array( - 'tcp://MYIP:26379?timeout=3' - ), + 'parameters' => ['tcp://10.0.0.1', 'tcp://10.0.0.2', 'tcp://10.0.0.3'], 'options' => array( - 'distributedStrategy' => 'cluster', + 'cluster' => 'predis', 'keyHashTags' => array("{one}", "{two}", "{three}") ) )); @@ -479,32 +232,6 @@ public function testRedisWithClustersKeyHashTagsValid() $predis->get('this_is_a_test_key'); } - public function testRedisSSLWithClusterFails() - { - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException'); - $predis = new PRedis(array( - 'options' => array( - 'distributedStrategy' => 'cluster', - ), - 'parameters' => array( - 'tls' => array(), - ), - )); - } - - public function testRedisSSLWithSentinelFails() - { - $this->expectException('SplitIO\Component\Cache\Storage\Exception\AdapterException'); - $predis = new PRedis(array( - 'options' => array( - 'distributedStrategy' => 'sentinel', - ), - 'parameters' => array( - 'tls' => array(), - ), - )); - } - public function testRedisWithWrongPrefix() { $predis = new PRedis(array( From 5760067db42bfe05ed876cc949d6a39bf13f493c Mon Sep 17 00:00:00 2001 From: Matias Melograno Date: Wed, 8 Nov 2023 10:28:39 -0300 Subject: [PATCH 2/4] updated php dependency --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b89c07b5..25897e5b 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ }, "require-dev": { - "phpunit/phpunit": "^9.0.0", + "phpunit/phpunit": "^9.6", "squizlabs/php_codesniffer": "3.*", "rogervila/php-sonarqube-scanner": "1.1.0", "mockery/mockery": "^1.5" From 841121c7a1791751b6f3cc0d87ec59a41c9afff4 Mon Sep 17 00:00:00 2001 From: Matias Melograno Date: Wed, 8 Nov 2023 10:33:56 -0300 Subject: [PATCH 3/4] updated ci --- .github/workflows/ci.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d97d84a3..f9e680cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,11 @@ name: ci on: - pull_request: - branches: - - develop - - master push: - branches: - - develop - - master + branches-ignore: + - none + pull_request: + branches-ignore: + - none concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number }} @@ -31,7 +29,7 @@ jobs: - '8.2' steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -66,7 +64,6 @@ jobs: projectBaseDir: . args: > -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} - -Dsonar.projectVersion=${{ env.VERSION }} - name: SonarQube Scan (Pull Request) if: matrix.version == '8.2' && github.event_name == 'pull_request' @@ -78,7 +75,6 @@ jobs: projectBaseDir: . args: > -Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} - -Dsonar.projectVersion=${{ env.VERSION }} -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} -Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} -Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} \ No newline at end of file From 333457d43812c1c39daf245de9ab1b08273e56cf Mon Sep 17 00:00:00 2001 From: Matias Melograno Date: Fri, 19 Jan 2024 14:25:16 -0300 Subject: [PATCH 4/4] more updates --- .../Cache/Storage/Adapter/PRedis.php | 33 +++++-------------- src/SplitIO/Sdk/ClientInterface.php | 5 +-- src/SplitIO/Sdk/Factory/SplitFactory.php | 18 ---------- src/SplitIO/Sdk/LocalhostClient.php | 2 +- 4 files changed, 13 insertions(+), 45 deletions(-) diff --git a/src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php b/src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php index 0f12bb81..e5a4a680 100644 --- a/src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php +++ b/src/SplitIO/Component/Cache/Storage/Adapter/PRedis.php @@ -14,6 +14,9 @@ class PRedis implements CacheStorageAdapterInterface /** @var \Predis\Client|null */ private $client = null; + /** @var string */ + private $prefix = ""; + /** * @param array $options * @throws AdapterException @@ -26,6 +29,10 @@ public function __construct(array $options) $_redisConfig = $this->getRedisConfiguration($options); $this->client = new \Predis\Client($_redisConfig['parameters'], $_redisConfig['options']); + + if (isset($_redisConfig['options']['prefix'])) { + $this->prefix = $_redisConfig['options']['prefix']; + } } /** @@ -179,30 +186,8 @@ public function isOnList($key, $value) public function getKeys($pattern = '*') { - $prefix = null; - if ($this->client->getOptions()->__isset("prefix")) { - $prefix = $this->client->getOptions()->__get("prefix")->getPrefix(); - } - - if ($this->client->getOptions()->__isset("cluster")) { - $keys = array(); - foreach ($this->client as $nodeClient) { - $nodeClientKeys = $nodeClient->keys($pattern); - $keys = array_merge($keys, $nodeClientKeys); - } - } else { - $keys = $this->client->keys($pattern); - } - if ($prefix) { - if (is_array($keys)) { - foreach ($keys as $index => $key) { - $keys[$index] = str_replace($prefix, '', $key); - } - } else { - $keys = str_replace($prefix, '', $keys); - } - } - return $keys; + $keys = $this->client->keys($pattern); + return str_replace($this->prefix, '', $keys); } private static function normalizePrefix($prefix) diff --git a/src/SplitIO/Sdk/ClientInterface.php b/src/SplitIO/Sdk/ClientInterface.php index d3b31eab..b070116e 100644 --- a/src/SplitIO/Sdk/ClientInterface.php +++ b/src/SplitIO/Sdk/ClientInterface.php @@ -168,8 +168,9 @@ public function isTreatment($key, $featureFlagName, $treatment); * @param $key * @param $trafficType * @param $eventType - * @param null $value + * @param $value + * @param $properties * @return boolean */ - public function track($key, $trafficType, $eventType, $value = null); + public function track($key, $trafficType, $eventType, $value = null, $properties = null); } diff --git a/src/SplitIO/Sdk/Factory/SplitFactory.php b/src/SplitIO/Sdk/Factory/SplitFactory.php index 8819db1f..0058ee50 100644 --- a/src/SplitIO/Sdk/Factory/SplitFactory.php +++ b/src/SplitIO/Sdk/Factory/SplitFactory.php @@ -45,9 +45,6 @@ public function __construct($sdkKey, Pool $cache, array $options = array()) $this->options = $options; $this->cache = $cache; - //Block until ready - $this->doBUR(); - $eventCache = new EventsCache($cache); $impressionCache = new ImpressionCache($cache); $segmentCache = new SegmentCache($cache); @@ -63,21 +60,6 @@ public function __construct($sdkKey, Pool $cache, array $options = array()) $this->manager = new SplitManager($splitCache); } - private function doBUR() - { - /* - Deprecated - $ready = (isset($this->options['ready']) && $this->options['ready'] > 0) ? $this->options['ready'] : null; - - //Block Until Ready - if ($ready) { - if (!$this->blockUntilReady($ready)) { - throw new TimeOutException("Cache data is not ready yet"); - } - } - */ - } - /** * @return \SplitIO\Sdk\ClientInterface */ diff --git a/src/SplitIO/Sdk/LocalhostClient.php b/src/SplitIO/Sdk/LocalhostClient.php index ac86afa6..2af44546 100644 --- a/src/SplitIO/Sdk/LocalhostClient.php +++ b/src/SplitIO/Sdk/LocalhostClient.php @@ -253,7 +253,7 @@ public function isTreatment($key, $featureFlagName, $treatment) /** * @inheritdoc */ - public function track($key, $trafficType, $eventType, $value = null) + public function track($key, $trafficType, $eventType, $value = null, $properties = null) { return true; }