Skip to content

Conversation

@mnoman09
Copy link
Contributor

@mnoman09 mnoman09 commented Jan 2, 2023

Summary

  • Fixed getDefaultRequestConfigWithTimeout function to allow creating separate requestConfigs with different timeout. Reusing same object will not allow us set different timeout, it will use the same timeout for all the API requests. This will cause an issue when creating request config for SegmentAPIManager and EventAPIManager.

Test plan

All test should pass.

Copy link
Contributor

@jaeopt jaeopt left a 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) {
Copy link
Contributor

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 ?
Copy link
Contributor

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) {
Copy link
Contributor

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()

Copy link
Contributor Author

@mnoman09 mnoman09 Jan 5, 2023

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) {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@mnoman09 mnoman09 changed the title Feat: Added odp config disable functionality Fix: Removed null check from getDefaultRequestConfigWithTimeout to create separate request configs Jan 5, 2023
@mnoman09 mnoman09 removed their assignment Jan 5, 2023
Copy link
Contributor

@jaeopt jaeopt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from zeeshan/ats-get-qualified-segments-null-FSSDK-8728 to master January 6, 2023 19:34
@jaeopt jaeopt merged commit 3f7c53c into master Jan 6, 2023
@jaeopt jaeopt deleted the mnoman/disableODP branch January 6, 2023 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants