From 353830d037554c1336f368e90565702931b5b210 Mon Sep 17 00:00:00 2001 From: pulak-opti Date: Tue, 29 Oct 2024 10:19:21 +0600 Subject: [PATCH] remove deepcopy method Signed-off-by: pulak-opti --- pkg/decision/entities.go | 21 ------------------- pkg/decision/persisting_experiment_service.go | 2 +- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/pkg/decision/entities.go b/pkg/decision/entities.go index c1c5afd9..1dcd7915 100644 --- a/pkg/decision/entities.go +++ b/pkg/decision/entities.go @@ -95,24 +95,3 @@ type UserProfile struct { ID string ExperimentBucketMap map[UserDecisionKey]string } - -// DeepCopy creates a deep copy of the UserProfile. -func (up *UserProfile) DeepCopy() *UserProfile { - if up == nil { - return nil - } - - userProfileCopy := UserProfile{ - ID: up.ID, - } - - // Deep copy the ExperimentBucketMap - if up.ExperimentBucketMap != nil { - userProfileCopy.ExperimentBucketMap = make(map[UserDecisionKey]string) - for k, v := range up.ExperimentBucketMap { - userProfileCopy.ExperimentBucketMap[k] = v - } - } - - return &userProfileCopy -} diff --git a/pkg/decision/persisting_experiment_service.go b/pkg/decision/persisting_experiment_service.go index 6d8a4427..5e52f229 100644 --- a/pkg/decision/persisting_experiment_service.go +++ b/pkg/decision/persisting_experiment_service.go @@ -89,7 +89,7 @@ func (p PersistingExperimentService) getSavedDecision(decisionContext Experiment if decisionContext.UserProfile == nil { userProfile = p.userProfileService.Lookup(userContext.ID) } else { - userProfile = *decisionContext.UserProfile.DeepCopy() + userProfile = *decisionContext.UserProfile } // look up experiment decision from user profile