@@ -652,16 +652,12 @@ export default class EppoClient {
652
652
}
653
653
654
654
private logBanditAction ( banditEvent : IBanditEvent ) : void {
655
+ // First we check if this bandit action has been logged before
655
656
const subjectKey = banditEvent . subject ;
656
657
const flagKey = banditEvent . featureFlag ;
657
658
const banditKey = banditEvent . bandit ;
658
659
const actionKey = banditEvent . action ?? '__eppo_no_action' ;
659
660
660
- // What our bandit assignment cache cares about for avoiding logging duplicate bandit assignments,
661
- // if one is active. Like the flag assignment cache, entries are only stored for a given flag
662
- // and subject. However, Bandit and action keys are also used for determining assignment uniqueness.
663
- // This means that if a flag's bandit assigns one action, and then later a new action, the first
664
- // one will be evicted from the cache. If later assigned again, it will be treated as new.
665
661
const banditAssignmentCacheProperties = {
666
662
flagKey,
667
663
subjectKey,
@@ -674,13 +670,15 @@ export default class EppoClient {
674
670
return ;
675
671
}
676
672
673
+ // If no logger defined, queue up the events (up to a max) to flush if a logger is later defined
677
674
if ( ! this . banditLogger ) {
678
675
// No bandit logger set; enqueue the event in case a logger is later set
679
676
if ( this . queuedBanditEvents . length < MAX_EVENT_QUEUE_SIZE ) {
680
677
this . queuedBanditEvents . push ( banditEvent ) ;
681
678
}
682
679
return ;
683
680
}
681
+
684
682
// If here, we have a logger and a new assignment to be logged
685
683
try {
686
684
this . banditLogger . logBanditAction ( banditEvent ) ;
0 commit comments