@@ -670,18 +670,15 @@ export default class EppoClient {
670
670
return ;
671
671
}
672
672
673
- // If no logger defined, queue up the events (up to a max) to flush if a logger is later defined
674
- if ( ! this . banditLogger ) {
675
- // No bandit logger set; enqueue the event in case a logger is later set
676
- if ( this . queuedBanditEvents . length < MAX_EVENT_QUEUE_SIZE ) {
677
- this . queuedBanditEvents . push ( banditEvent ) ;
678
- }
679
- return ;
680
- }
681
-
682
673
// If here, we have a logger and a new assignment to be logged
683
674
try {
684
- this . banditLogger . logBanditAction ( banditEvent ) ;
675
+ if ( this . banditLogger ) {
676
+ this . banditLogger . logBanditAction ( banditEvent ) ;
677
+ } else if ( this . queuedBanditEvents . length < MAX_EVENT_QUEUE_SIZE ) {
678
+ // If no logger defined, queue up the events (up to a max) to flush if a logger is later defined
679
+ this . queuedBanditEvents . push ( banditEvent ) ;
680
+ }
681
+ // Record in the assignment cache, if active, to deduplicate subsequent repeat assignments
685
682
this . banditAssignmentCache ?. set ( banditAssignmentCacheProperties ) ;
686
683
} catch ( err ) {
687
684
logger . warn ( 'Error encountered logging bandit action' , err ) ;
@@ -994,14 +991,14 @@ export default class EppoClient {
994
991
}
995
992
}
996
993
997
- // assignment logger may be null while waiting for initialization
998
- if ( ! this . assignmentLogger ) {
999
- this . queuedAssignmentEvents . length < MAX_EVENT_QUEUE_SIZE &&
1000
- this . queuedAssignmentEvents . push ( event ) ;
1001
- return ;
1002
- }
1003
994
try {
1004
- this . assignmentLogger . logAssignment ( event ) ;
995
+ if ( this . assignmentLogger ) {
996
+ this . assignmentLogger . logAssignment ( event ) ;
997
+ } else if ( this . queuedAssignmentEvents . length < MAX_EVENT_QUEUE_SIZE ) {
998
+ // assignment logger may be null while waiting for initialization, queue up events (up to a max)
999
+ // to be flushed when set
1000
+ this . queuedAssignmentEvents . push ( event ) ;
1001
+ }
1005
1002
this . assignmentCache ?. set ( {
1006
1003
flagKey,
1007
1004
subjectKey,
0 commit comments