@@ -14,7 +14,7 @@ class SplitSynchronizers(object):
1414 """SplitSynchronizers."""
1515
1616 def __init__ (self , split_sync , segment_sync , impressions_sync , events_sync , # pylint:disable=too-many-arguments
17- impressions_count_sync ):
17+ impressions_count_sync , unique_keys_sync = None , clear_filter_sync = None ):
1818 """
1919 Class constructor.
2020
@@ -34,6 +34,8 @@ def __init__(self, split_sync, segment_sync, impressions_sync, events_sync, # p
3434 self ._impressions_sync = impressions_sync
3535 self ._events_sync = events_sync
3636 self ._impressions_count_sync = impressions_count_sync
37+ self ._unique_keys_sync = unique_keys_sync
38+ self ._clear_filter_sync = clear_filter_sync
3739
3840 @property
3941 def split_sync (self ):
@@ -60,11 +62,21 @@ def impressions_count_sync(self):
6062 """Return impressions count synchonizer."""
6163 return self ._impressions_count_sync
6264
65+ @property
66+ def unique_keys_sync (self ):
67+ """Return unique keys synchonizer."""
68+ return self ._unique_keys_sync
69+
70+ @property
71+ def clear_filter_sync (self ):
72+ """Return clear filter synchonizer."""
73+ return self ._clear_filter_sync
74+
6375class SplitTasks (object ):
6476 """SplitTasks."""
6577
6678 def __init__ (self , split_task , segment_task , impressions_task , events_task , # pylint:disable=too-many-arguments
67- impressions_count_task ):
79+ impressions_count_task , unique_keys_task = None , clear_filter_task = None ):
6880 """
6981 Class constructor.
7082
@@ -84,6 +96,8 @@ def __init__(self, split_task, segment_task, impressions_task, events_task, # p
8496 self ._impressions_task = impressions_task
8597 self ._events_task = events_task
8698 self ._impressions_count_task = impressions_count_task
99+ self ._unique_keys_task = unique_keys_task
100+ self ._clear_filter_task = clear_filter_task
87101
88102 @property
89103 def split_task (self ):
@@ -110,6 +124,16 @@ def impressions_count_task(self):
110124 """Return impressions count sync task."""
111125 return self ._impressions_count_task
112126
127+ @property
128+ def unique_keys_task (self ):
129+ """Return unique keys sync task."""
130+ return self ._unique_keys_task
131+
132+ @property
133+ def clear_filter_task (self ):
134+ """Return clear filter sync task."""
135+ return self ._clear_filter_task
136+
113137class BaseSynchronizer (object , metaclass = abc .ABCMeta ):
114138 """Synchronizer interface."""
115139
@@ -300,8 +324,11 @@ def start_periodic_data_recording(self):
300324 _LOGGER .debug ('Starting periodic data recording' )
301325 self ._split_tasks .impressions_task .start ()
302326 self ._split_tasks .events_task .start ()
303- if self ._split_tasks .impressions_count_task is not None :
304- self ._split_tasks .impressions_count_task .start ()
327+ self ._split_tasks .impressions_count_task .start ()
328+ if self ._split_tasks .unique_keys_task is not None :
329+ self ._split_tasks .unique_keys_task .start ()
330+ if self ._split_tasks .clear_filter_task is not None :
331+ self ._split_tasks .clear_filter_task .start ()
305332
306333 def stop_periodic_data_recording (self , blocking ):
307334 """
@@ -316,6 +343,11 @@ def stop_periodic_data_recording(self, blocking):
316343 tasks = [self ._split_tasks .impressions_task ,
317344 self ._split_tasks .events_task ,
318345 self ._split_tasks .impressions_count_task ]
346+ if self ._split_tasks .unique_keys_task is not None :
347+ tasks .append (self ._split_tasks .unique_keys_task )
348+ if self ._split_tasks .clear_filter_task is not None :
349+ tasks .append (self ._split_tasks .clear_filter_task )
350+
319351 for task in tasks :
320352 stop_event = threading .Event ()
321353 task .stop (stop_event )
@@ -325,8 +357,11 @@ def stop_periodic_data_recording(self, blocking):
325357 else :
326358 self ._split_tasks .impressions_task .stop ()
327359 self ._split_tasks .events_task .stop ()
328- if self ._split_tasks .impressions_count_task is not None :
329- self ._split_tasks .impressions_count_task .stop ()
360+ self ._split_tasks .impressions_count_task .stop ()
361+ if self ._split_tasks .unique_keys_task is not None :
362+ self ._split_tasks .unique_keys_task .stop ()
363+ if self ._split_tasks .clear_filter_task is not None :
364+ self ._split_tasks .clear_filter_task .stop ()
330365
331366 def kill_split (self , split_name , default_treatment , change_number ):
332367 """
@@ -342,8 +377,6 @@ def kill_split(self, split_name, default_treatment, change_number):
342377 self ._split_synchronizers .split_sync .kill_split (split_name , default_treatment ,
343378 change_number )
344379
345-
346-
347380class LocalhostSynchronizer (BaseSynchronizer ):
348381 """LocalhostSynchronizer."""
349382
0 commit comments