-
Notifications
You must be signed in to change notification settings - Fork 19
feat: added notification support for json variable #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment, will leave for @mjc1283 to approve
@@ -113,6 +114,9 @@ func (s CompositeService) GetFeatureDecision(featureDecisionContext FeatureDecis | |||
convertedValue, e = strconv.ParseFloat(variableValue, 64) | |||
case entities.Boolean: | |||
convertedValue, e = strconv.ParseBool(variableValue) | |||
case entities.JSON: | |||
convertedValue = map[string]string{} | |||
e = json.Unmarshal([]byte(variableValue), &convertedValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering now, if we should lazy unmarshal and cache the map in the variable itself the first time it is ever accessed and from there on we can just refer to that value. Seems like this could potentially be a costly operation to repeat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point
@@ -113,6 +114,9 @@ func (s CompositeService) GetFeatureDecision(featureDecisionContext FeatureDecis | |||
convertedValue, e = strconv.ParseFloat(variableValue, 64) | |||
case entities.Boolean: | |||
convertedValue, e = strconv.ParseBool(variableValue) | |||
case entities.JSON: | |||
convertedValue = map[string]string{} | |||
e = json.Unmarshal([]byte(variableValue), &convertedValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point
@@ -113,6 +114,9 @@ func (s CompositeService) GetFeatureDecision(featureDecisionContext FeatureDecis | |||
convertedValue, e = strconv.ParseFloat(variableValue, 64) | |||
case entities.Boolean: | |||
convertedValue, e = strconv.ParseBool(variableValue) | |||
case entities.JSON: | |||
convertedValue = map[string]string{} | |||
e = json.Unmarshal([]byte(variableValue), &convertedValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we pass the OptimizelyJSON object to the notification, rather than the JSON string? And apply memoization to creating the OptimizelyJSON as @mikeng13 suggested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
memoization is already done on OptimizelyJSON, the thing is that GetFeatureDecision does not know anything about OptimizelyJSON. This whole notification logic will need to be restructured.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes for the memoization - @pawels-optimizely let me know if that's reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed with @pawels-optimizely . We think the memoization should be done, but it requires more investigation to be done separately.
Summary