Skip to content

Commit

Permalink
connection id initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Tymek committed Jan 23, 2025
1 parent 206b548 commit 50c5260
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 12 additions & 3 deletions src/Repository/DefaultUnleashRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,23 @@
*/
final readonly class DefaultUnleashRepository implements UnleashRepository
{
private string $sdkName;

private string $sdkVersion;

private string $connectionId;

public function __construct(
private ClientInterface $httpClient,
private RequestFactoryInterface $requestFactory,
private UnleashConfiguration $configuration,
private string $sdkName = Unleash::SDK_NAME,
private string $sdkVersion = Unleash::SDK_VERSION,
private string $connectionId = Uuid::v4(),
?string $sdkName = null,
?string $sdkVersion = null,
?string $connectionId = null,
) {
$this->sdkName = $sdkName ?? Unleash::SDK_NAME;
$this->sdkVersion = $sdkVersion ?? Unleash::SDK_VERSION;
$this->connectionId = $connectionId ?? Uuid::v4();
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/UnleashBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ final class UnleashBuilder

private ?string $appName = null;

private string $connectionId = Uuid::v4();
private string $connectionId;

private ?ClientInterface $httpClient = null;

Expand Down Expand Up @@ -134,6 +134,8 @@ public function __construct()
$this->eventDispatcher = new EventDispatcher();
}

$this->connectionId = Uuid::v4();

$rolloutStrategyHandler = new GradualRolloutStrategyHandler(new MurmurHashCalculator());
$this->strategies = [
new DefaultStrategyHandler(),
Expand Down

0 comments on commit 50c5260

Please sign in to comment.