File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -87,13 +87,21 @@ class DefaultDecisionService: OPTDecisionService {
87
87
experiment: Experiment ,
88
88
user: OptimizelyUserContext ,
89
89
bucketingId: String ,
90
+ opType: OPType ,
90
91
options: [ OptimizelyDecideOption ] ? ) -> DecisionResponse < VariationDecision > {
91
92
let reasons = DecisionReasons ( options: options)
92
93
guard let cmab = experiment. cmab else {
93
94
logger. e ( " The experiment isn't a CMAB experiment " )
94
95
return DecisionResponse ( result: nil , reasons: reasons)
95
96
}
96
97
98
+ guard opType == . async else {
99
+ let info = LogMessage . cmabNotSupportedInSyncMode
100
+ logger. w ( info)
101
+ reasons. addInfo ( info)
102
+ return DecisionResponse ( result: nil , reasons: reasons)
103
+ }
104
+
97
105
let dummyEntityId = " $ "
98
106
let cmabTrafficAllocation = TrafficAllocation ( entityId: dummyEntityId, endOfRange: cmab. trafficAllocation)
99
107
let group = config. getGroup ( id: experiment. id)
@@ -260,13 +268,11 @@ class DefaultDecisionService: OPTDecisionService {
260
268
let bucketingId = getBucketingId ( userId: userId, attributes: attributes)
261
269
262
270
if experiment. isCmab {
263
- if opType == . sync {
264
- /// fixme
265
- }
266
271
let cmabDecisionResponse = getDecisionForCmabExperiment ( config: config,
267
272
experiment: experiment,
268
273
user: user,
269
274
bucketingId: bucketingId,
275
+ opType: opType,
270
276
options: options)
271
277
reasons. merge ( cmabDecisionResponse. reasons)
272
278
variationDecision = cmabDecisionResponse. result
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ enum LogMessage {
76
76
case valueForKeyNotFound( _ key: String )
77
77
case lowPeriodicDownloadInterval
78
78
case cmabFetchFailed( _ expKey: String )
79
+ case cmabNotSupportedInSyncMode
79
80
}
80
81
81
82
extension LogMessage : CustomStringConvertible {
@@ -146,6 +147,7 @@ extension LogMessage: CustomStringConvertible {
146
147
case . valueForKeyNotFound( let key) : message = " Value for JSON key ( \( key) ) not found. "
147
148
case . lowPeriodicDownloadInterval: message = " Polling intervals below 30 seconds are not recommended. "
148
149
case . cmabFetchFailed( let key) : message = " Failed to fetch CMAB data for experiment: \( key) "
150
+ case . cmabNotSupportedInSyncMode: message = " CMAB is not supported in sync mode. "
149
151
}
150
152
151
153
return message
You can’t perform that action at this time.
0 commit comments