Skip to content

Commit

Permalink
polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
sanzmauro committed Dec 12, 2024
1 parent 271390f commit 24de6f8
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/splitio/go-client/v6
go 1.18

require (
github.com/splitio/go-split-commons/v6 v6.0.3-0.20241211200100-36a7e1a3eeb9
github.com/splitio/go-split-commons/v6 v6.0.3-0.20241212182204-626e0eae79d0
github.com/splitio/go-toolkit/v5 v5.4.0
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ github.com/splitio/go-split-commons/v6 v6.0.2 h1:uvrNjyGCOHUjxVTB1pDUA+UB20Wypox
github.com/splitio/go-split-commons/v6 v6.0.2/go.mod h1:D/XIY/9Hmfk9ivWsRsJVp439kEdmHbzUi3PKzQQDOXY=
github.com/splitio/go-split-commons/v6 v6.0.3-0.20241211200100-36a7e1a3eeb9 h1:H5ALS64HcbNiEQyT8fLKPck9qEMpSjwM9DYeG0bvvTg=
github.com/splitio/go-split-commons/v6 v6.0.3-0.20241211200100-36a7e1a3eeb9/go.mod h1:D/XIY/9Hmfk9ivWsRsJVp439kEdmHbzUi3PKzQQDOXY=
github.com/splitio/go-split-commons/v6 v6.0.3-0.20241212182204-626e0eae79d0 h1:8udmFWKfa/vPyMSLqupxwHkXv1DxJum77XXY0AeNQZE=
github.com/splitio/go-split-commons/v6 v6.0.3-0.20241212182204-626e0eae79d0/go.mod h1:D/XIY/9Hmfk9ivWsRsJVp439kEdmHbzUi3PKzQQDOXY=
github.com/splitio/go-toolkit/v5 v5.4.0 h1:g5WFpRhQomnXCmvfsNOWV4s5AuUrWIZ+amM68G8NBKM=
github.com/splitio/go-toolkit/v5 v5.4.0/go.mod h1:xYhUvV1gga9/1029Wbp5pjnR6Cy8nvBpjw99wAbsMko=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
Expand Down
10 changes: 5 additions & 5 deletions splitio/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func getFactory() SplitFactory {
impressionObserver, _ := strategy.NewImpressionObserver(500)
impressionsCounter := strategy.NewImpressionsCounter()
impressionsStrategy := strategy.NewOptimizedImpl(impressionObserver, impressionsCounter, telemetryStorage, false)
impressionManager := provisional.NewImpressionManager(impressionsStrategy)
impressionManager := provisional.NewImpressionManager(impressionsStrategy).(*provisional.ImpressionManagerImpl)

return SplitFactory{
cfg: cfg,
Expand All @@ -166,7 +166,7 @@ func getFactoryByFlagSets() SplitFactory {
impressionObserver, _ := strategy.NewImpressionObserver(500)
impressionsCounter := strategy.NewImpressionsCounter()
impressionsStrategy := strategy.NewOptimizedImpl(impressionObserver, impressionsCounter, telemetryStorage, false)
impressionManager := provisional.NewImpressionManager(impressionsStrategy)
impressionManager := provisional.NewImpressionManager(impressionsStrategy).(*provisional.ImpressionManagerImpl)

return SplitFactory{
cfg: cfg,
Expand Down Expand Up @@ -473,7 +473,7 @@ func TestClientPanicking(t *testing.T) {
impressionObserver, _ := strategy.NewImpressionObserver(500)
impressionsCounter := strategy.NewImpressionsCounter()
impressionsStrategy := strategy.NewOptimizedImpl(impressionObserver, impressionsCounter, telemetryMockedStorage, false)
impressionManager := provisional.NewImpressionManager(impressionsStrategy)
impressionManager := provisional.NewImpressionManager(impressionsStrategy).(*provisional.ImpressionManagerImpl)

factory := SplitFactory{
cfg: cfg,
Expand Down Expand Up @@ -650,7 +650,7 @@ func getClientForListener() SplitClient {
impressionObserver, _ := strategy.NewImpressionObserver(500)
impressionsCounter := strategy.NewImpressionsCounter()
impressionsStrategy := strategy.NewOptimizedImpl(impressionObserver, impressionsCounter, telemetryMockedStorage, true)
impressionManager := provisional.NewImpressionManager(impressionsStrategy)
impressionManager := provisional.NewImpressionManager(impressionsStrategy).(*provisional.ImpressionManagerImpl)

factory := &SplitFactory{
cfg: cfg,
Expand Down Expand Up @@ -1372,7 +1372,7 @@ func TestClient(t *testing.T) {

impressionObserver, _ := strategy.NewImpressionObserver(500)
impressionsStrategy := strategy.NewDebugImpl(impressionObserver, true)
impressionManager := provisional.NewImpressionManager(impressionsStrategy)
impressionManager := provisional.NewImpressionManager(impressionsStrategy).(*provisional.ImpressionManagerImpl)

factory := &SplitFactory{cfg: cfg, impressionManager: impressionManager}
client := SplitClient{
Expand Down
2 changes: 1 addition & 1 deletion splitio/client/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ func setupLocalhostFactory(
return nil, err
}
impressionsStrategy := strategy.NewDebugImpl(impressionObserver, cfg.Advanced.ImpressionListener != nil)
splitFactory.impressionManager = provisional.NewImpressionManager(impressionsStrategy)
splitFactory.impressionManager = provisional.NewImpressionManager(impressionsStrategy).(*provisional.ImpressionManagerImpl)
setFactory(splitFactory.apikey, splitFactory.logger)

// Call fetching tasks as goroutine
Expand Down
2 changes: 1 addition & 1 deletion splitio/client/input_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func getClient() SplitClient {
impressionObserver, _ := strategy.NewImpressionObserver(500)
impressionsCounter := strategy.NewImpressionsCounter()
impressionsStrategy := strategy.NewOptimizedImpl(impressionObserver, impressionsCounter, telemetryMockedStorage, true)
impressionManager := provisional.NewImpressionManager(impressionsStrategy)
impressionManager := provisional.NewImpressionManager(impressionsStrategy).(*provisional.ImpressionManagerImpl)

factory := &SplitFactory{cfg: cfg, impressionManager: impressionManager,
storages: sdkStorages{
Expand Down
10 changes: 6 additions & 4 deletions splitio/impressions/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ func BuildInMemoryManager(
noneStrategy := strategy.NewNoneImpl(impressionsCounter, uniqueKeysTracker, listenerEnabled)

if cfg.ImpressionsMode == config.ImpressionsModeNone {
return provisional.NewImpressionManager(noneStrategy), nil
impManager := provisional.NewImpressionManager(noneStrategy)
return impManager.(*provisional.ImpressionManagerImpl), nil
}

workers.ImpressionRecorder = impression.NewRecorderSingle(impressionStorage, splitAPI.ImpressionRecorder, logger, metadata, cfg.ImpressionsMode, telemetryStorage)
Expand All @@ -72,7 +73,7 @@ func BuildInMemoryManager(
impressionsStrategy = strategy.NewOptimizedImpl(impressionObserver, impressionsCounter, telemetryStorage, listenerEnabled)
}

manager := provisional.NewImpressionManager(impressionsStrategy)
manager := provisional.NewImpressionManager(impressionsStrategy).(*provisional.ImpressionManagerImpl)
manager.SetNoneStrategy(noneStrategy)

return manager, nil
Expand Down Expand Up @@ -102,7 +103,8 @@ func BuildRedisManager(
noneStrategy := strategy.NewNoneImpl(impressionsCounter, uniqueKeysTracker, listenerEnabled)

if cfg.ImpressionsMode == config.ImpressionsModeNone {
return provisional.NewImpressionManager(noneStrategy), nil
impManager := provisional.NewImpressionManager(noneStrategy)
return impManager.(*provisional.ImpressionManagerImpl), nil
}

impressionObserver, err := strategy.NewImpressionObserver(500)
Expand All @@ -118,7 +120,7 @@ func BuildRedisManager(
impressionsStrategy = strategy.NewOptimizedImpl(impressionObserver, impressionsCounter, telemetryRuntimeStorage, listenerEnabled)
}

manager := provisional.NewImpressionManager(impressionsStrategy)
manager := provisional.NewImpressionManager(impressionsStrategy).(*provisional.ImpressionManagerImpl)
manager.SetNoneStrategy(noneStrategy)

return manager, nil
Expand Down

0 comments on commit 24de6f8

Please sign in to comment.