-
Notifications
You must be signed in to change notification settings - Fork 32
Fix: Removed null check from getDefaultRequestConfigWithTimeout to create separate request configs #498
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
…ding odpEvent upon creating just a copy of UserContext
jaeopt
left a comment
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.
A few clarifications. We can continue discussion in Teams if I miss the points.
| this.odpManager = odpManager; | ||
|
|
||
| if (odpManager != null) { | ||
| if (odpManager != null && odpManager.getEventManager() != null) { |
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.
Do we need this extra null checking? ODPManager has NonNull segmentManager and eventManager.
| if (odpManager != null) { | ||
| synchronized (odpManager) { | ||
| return odpManager.getSegmentManager().getQualifiedSegments(userId, segmentOptions); | ||
| return odpManager.getSegmentManager() != null ? |
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.
Same NonNull as EventManager
| } | ||
|
|
||
| private ODPManager(@Nonnull ODPSegmentManager segmentManager, @Nonnull ODPEventManager eventManager, boolean disable) { | ||
| if (!disable) { |
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.
Java integrates ODP with builder pattern. ODPManager is expected to pass for initialization only when enabled.
I think we may not need this redundant "disable" control here.
enabled:
OptimizelyBuilder().withOdpManager(...).build()
disabled:
OptimizelyBuilder().build()
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.
That is correct. I added it to keep it consistent but for now I reverted adding odpDisable option in odpManager
| .build(); | ||
|
|
||
| public static RequestConfig getDefaultRequestConfigWithTimeout(int timeoutMillis) { | ||
| if (requestConfigWithTimeout == null) { |
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 understand we try to re-use RequestConfig once created. Curious why we do not want to reuse?
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.
this function is getting used at multiple places (for setting request config with timeout of SegmentAPIManager as well as for EventAPIManager). If we want to use different timeout for different Request config then this check will not allow that as it will return the first object that was initialized.
jaeopt
left a comment
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
Summary
Test plan
All test should pass.