Skip to content

Conversation

FarhanAnjum-opti
Copy link
Contributor

@FarhanAnjum-opti FarhanAnjum-opti commented Sep 24, 2025

Summary

Decision Service methods to handle CMAB

Test plan

Added unit tests

Issues

FSSDK-11170

…ations over CMAB service decisions in DecisionService
Copy link
Contributor

@muzahidul-opti muzahidul-opti left a comment

Choose a reason for hiding this comment

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

Changes look good to me. Added few comments.

@Nullable ODPManager odpManager
) {
@Nullable ODPManager odpManager,
@Nonnull CmabService cmabService
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like breaking change, can we make nullable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Javascript and all other server side implementations have cmabService as a mandatory field (non null). It shouldn't be breaking.

private String cmabUUID;

public DecisionResponse(@Nullable T result, @Nonnull DecisionReasons reasons) {
public DecisionResponse(@Nullable T result, @Nonnull DecisionReasons reasons, @Nonnull boolean error, @Nullable String cmabUUID) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it impact the existing user?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, existing users can still use this class as they were. In that case cmabUUID will be set null and error will be false. Class behaviour will be same.

public int hashCode() {
int result = variation != null ? variation.hashCode() : 0;
result = 31 * result + (decisionSource != null ? decisionSource.hashCode() : 0);
result = 31 * result + (cmabUUID != null ? cmabUUID.hashCode() : 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious to know, what is the significant of 31 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

31 is chosen as a prime number here to avoid hash collisions. Its chosen because of Java norm (googled it).

* AsyncDecisionsFetcher handles asynchronous decision fetching for multiple flag keys.
* This class follows the same pattern as ODP's async segment fetching.
*/
public class AsyncDecisionsFetcher extends Thread {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we shift the code into AysncDecisionFeatcher ?

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.

2 participants