@@ -5,16 +5,13 @@ import { ImpressionsPayload } from './types';
55import { SUBMITTERS_PUSH_FULL_QUEUE } from '../../logger/constants' ;
66import { ISdkFactoryContextSync } from '../../sdkFactory/types' ;
77
8- const DATA_NAME = 'impressions' ;
9-
108/**
119 * Converts `impressions` data from cache into request payload.
1210 */
1311export function fromImpressionsCollector ( sendLabels : boolean , data : SplitIO . ImpressionDTO [ ] ) : ImpressionsPayload {
1412 let groupedByFeature = groupBy ( data , 'feature' ) ;
1513 let dto : ImpressionsPayload = [ ] ;
1614
17- // using forOwn instead of for...in since the last also iterates over prototype enumerables
1815 forOwn ( groupedByFeature , ( value , name ) => {
1916 dto . push ( {
2017 f : name , // Test Name
@@ -50,12 +47,12 @@ export function impressionsSubmitterFactory(params: ISdkFactoryContextSync) {
5047 } = params ;
5148
5249 // retry impressions only once.
53- const syncTask = submitterFactory ( log , postTestImpressionsBulk , impressions , impressionsRefreshRate , DATA_NAME , fromImpressionsCollector . bind ( undefined , labelsEnabled ) , 1 ) ;
50+ const syncTask = submitterFactory ( log , postTestImpressionsBulk , impressions , impressionsRefreshRate , fromImpressionsCollector . bind ( undefined , labelsEnabled ) , 1 ) ;
5451
5552 // register impressions submitter to be executed when impressions cache is full
5653 impressions . setOnFullQueueCb ( ( ) => {
5754 if ( syncTask . isRunning ( ) ) {
58- log . info ( SUBMITTERS_PUSH_FULL_QUEUE , [ DATA_NAME ] ) ;
55+ log . info ( SUBMITTERS_PUSH_FULL_QUEUE , [ impressions . name ] ) ;
5956 syncTask . execute ( ) ;
6057 }
6158 // If submitter is stopped (e.g., user consent declined or unknown, or app state offline), we don't send the data.
0 commit comments