@@ -292,12 +292,13 @@ def _wrap_impression_listener(listener, metadata):
292292 return None
293293
294294
295- def _build_in_memory_factory (api_key , cfg , extra_cfg , sdk_url = None , events_url = None , # pylint:disable=too-many-arguments,too-many-locals
295+ def _build_in_memory_factory (api_key , cfg , sdk_url = None , events_url = None , # pylint:disable=too-many-arguments,too-many-locals
296296 auth_api_base_url = None , streaming_api_base_url = None , telemetry_api_base_url = None ):
297297 """Build and return a split factory tailored to the supplied config."""
298298 if not input_validator .validate_factory_instantiation (api_key ):
299299 return None
300300
301+ extra_cfg = {}
301302 extra_cfg ['sdk_url' ] = sdk_url
302303 extra_cfg ['events_url' ] = events_url
303304 extra_cfg ['auth_url' ] = auth_api_base_url
@@ -524,7 +525,6 @@ def get_factory(api_key, **kwargs):
524525 )
525526
526527 config = sanitize_config (api_key , kwargs .get ('config' , {}))
527- extra_config = {}
528528
529529 if config ['operationMode' ] == 'localhost-standalone' :
530530 return _build_localhost_factory (config )
@@ -535,20 +535,22 @@ def get_factory(api_key, **kwargs):
535535 return _build_in_memory_factory (
536536 api_key ,
537537 config ,
538- extra_config ,
539538 kwargs .get ('sdk_api_base_url' ),
540539 kwargs .get ('events_api_base_url' ),
541540 kwargs .get ('auth_api_base_url' ),
542541 kwargs .get ('streaming_api_base_url' ),
543542 kwargs .get ('telemetry_api_base_url' )
544543 )
545544 finally :
546- redundant_factory_count = 0
547- active_factory_count = 0
548545 _INSTANTIATED_FACTORIES .update ([api_key ])
549- for item in _INSTANTIATED_FACTORIES :
550- redundant_factory_count = redundant_factory_count + _INSTANTIATED_FACTORIES [item ] - 1
551- active_factory_count = active_factory_count + _INSTANTIATED_FACTORIES [item ]
552- extra_config ['redundant_factory_count' ] = redundant_factory_count
553- extra_config ['active_factory_count' ] = active_factory_count
554546 _INSTANTIATED_FACTORIES_LOCK .release ()
547+
548+ def _get_active_and_derundant_count ():
549+ redundant_factory_count = 0
550+ active_factory_count = 0
551+ _INSTANTIATED_FACTORIES_LOCK .acquire ()
552+ for item in _INSTANTIATED_FACTORIES :
553+ redundant_factory_count = redundant_factory_count + _INSTANTIATED_FACTORIES [item ] - 1
554+ active_factory_count = active_factory_count + _INSTANTIATED_FACTORIES [item ]
555+ _INSTANTIATED_FACTORIES_LOCK .release ()
556+ return redundant_factory_count , active_factory_count
0 commit comments