@@ -11,7 +11,7 @@ class ImpressionsMode(Enum):
1111class Manager (object ): # pylint:disable=too-few-public-methods
1212 """Impression manager."""
1313
14- def __init__ (self , strategy , telemetry_runtime_producer ):
14+ def __init__ (self , strategy , none_strategy , telemetry_runtime_producer ):
1515 """
1616 Construct a manger to track and forward impressions to the queue.
1717
@@ -23,19 +23,33 @@ def __init__(self, strategy, telemetry_runtime_producer):
2323 """
2424
2525 self ._strategy = strategy
26+ self ._none_strategy = none_strategy
2627 self ._telemetry_runtime_producer = telemetry_runtime_producer
2728
28- def process_impressions (self , impressions ):
29+ def process_impressions (self , impressions_decorated ):
2930 """
3031 Process impressions.
3132
3233 Impressions are analyzed to see if they've been seen before and counted.
3334
34- :param impressions : List of impression objects with attributes
35- :type impressions : list[tuple[splitio.models.impression.Impression , dict]]
35+ :param impressions_decorated : List of impression objects with attributes
36+ :type impressions_decorated : list[tuple[splitio.models.impression.ImpressionDecorated , dict]]
3637
3738 :return: processed and deduped impressions.
3839 :rtype: tuple(list[tuple[splitio.models.impression.Impression, dict]], list(int))
3940 """
40- for_log , for_listener , for_counter , for_unique_keys_tracker = self ._strategy .process_impressions (impressions )
41- return for_log , len (impressions ) - len (for_log ), for_listener , for_counter , for_unique_keys_tracker
41+ for_listener_all = []
42+ for_log_all = []
43+ for_counter_all = []
44+ for_unique_keys_tracker_all = []
45+ for impression_decorated , att in impressions_decorated :
46+ if not impression_decorated .track :
47+ for_log , for_listener , for_counter , for_unique_keys_tracker = self ._none_strategy .process_impressions ([(impression_decorated .Impression , att )])
48+ else :
49+ for_log , for_listener , for_counter , for_unique_keys_tracker = self ._strategy .process_impressions ([(impression_decorated .Impression , att )])
50+ for_listener_all .extend (for_listener )
51+ for_log_all .extend (for_log )
52+ for_counter_all .extend (for_counter )
53+ for_unique_keys_tracker_all .extend (for_unique_keys_tracker )
54+
55+ return for_log_all , len (impressions_decorated ) - len (for_log_all ), for_listener_all , for_counter_all , for_unique_keys_tracker_all
0 commit comments