-
Notifications
You must be signed in to change notification settings - Fork 32
[FSSDK-11143] update: Implement CMAB Client #579
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
base: master
Are you sure you want to change the base?
[FSSDK-11143] update: Implement CMAB Client #579
Conversation
…chDecision method and retry logic
…s and error handling
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.
Looks good to me. Added a couple of comments.
* @param cmabUuid The CMAB UUID | ||
* @return CompletableFuture containing the variation ID as a String | ||
*/ | ||
CompletableFuture<String> fetchDecision(String ruleId, String userId, Map<String, Object> attributes, String cmabUuid); |
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.
nit: can we rename it as cmabUUID?
private final int maxRetries; | ||
private final long backoffBaseMs; | ||
private final double backoffMultiplier; | ||
|
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 think there should a maxTimeout.
if (attemptNumber < 0) { | ||
return 0; | ||
} | ||
return (long) (backoffBaseMs * Math.pow(backoffMultiplier, attemptNumber)); |
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 logic should be updated with maxTimeOut
Summary
Implemented DefaultCmabClient, a client for fetching CMAB (Contextual Multi-Armed Bandit) decisions.
Supports configurable retries with exponential backoff through CmabRetryConfig.
Handles error scenarios such as network failures, non-2xx responses, invalid JSON, and malformed responses.
Logs relevant error and retry information using the Optimizely logger.
Test plan
Issues