@@ -5,16 +5,13 @@ import { ImpressionsPayload } from './types';
5
5
import { SUBMITTERS_PUSH_FULL_QUEUE } from '../../logger/constants' ;
6
6
import { ISdkFactoryContextSync } from '../../sdkFactory/types' ;
7
7
8
- const DATA_NAME = 'impressions' ;
9
-
10
8
/**
11
9
* Converts `impressions` data from cache into request payload.
12
10
*/
13
11
export function fromImpressionsCollector ( sendLabels : boolean , data : SplitIO . ImpressionDTO [ ] ) : ImpressionsPayload {
14
12
let groupedByFeature = groupBy ( data , 'feature' ) ;
15
13
let dto : ImpressionsPayload = [ ] ;
16
14
17
- // using forOwn instead of for...in since the last also iterates over prototype enumerables
18
15
forOwn ( groupedByFeature , ( value , name ) => {
19
16
dto . push ( {
20
17
f : name , // Test Name
@@ -50,12 +47,12 @@ export function impressionsSubmitterFactory(params: ISdkFactoryContextSync) {
50
47
} = params ;
51
48
52
49
// 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 ) ;
54
51
55
52
// register impressions submitter to be executed when impressions cache is full
56
53
impressions . setOnFullQueueCb ( ( ) => {
57
54
if ( syncTask . isRunning ( ) ) {
58
- log . info ( SUBMITTERS_PUSH_FULL_QUEUE , [ DATA_NAME ] ) ;
55
+ log . info ( SUBMITTERS_PUSH_FULL_QUEUE , [ impressions . name ] ) ;
59
56
syncTask . execute ( ) ;
60
57
}
61
58
// If submitter is stopped (e.g., user consent declined or unknown, or app state offline), we don't send the data.
0 commit comments