|
76 | 76 | start_pool/3, |
77 | 77 | stop_pool/1, |
78 | 78 | pool_started/1, |
79 | | - %% Import cache management |
80 | | - flush_all_imports/1, |
81 | 79 | %% Pool registration (route module/func to specific pools) |
82 | 80 | register_pool/2, |
83 | 81 | register_pool/3, |
@@ -381,38 +379,6 @@ pool_started(Pool) when is_atom(Pool) -> |
381 | 379 | end |
382 | 380 | end. |
383 | 381 |
|
384 | | -%% @doc Flush import caches from all contexts in all pools. |
385 | | -%% |
386 | | -%% Iterates through all pools (default and registered) and removes |
387 | | -%% specified modules from sys.modules in each context's interpreter. |
388 | | -%% |
389 | | -%% @param Modules List of module names (binaries) to remove |
390 | | -%% @returns ok |
391 | | --spec flush_all_imports([binary()]) -> ok. |
392 | | -flush_all_imports(Modules) -> |
393 | | - %% Get all pool names from the registry |
394 | | - RegisteredPools = case persistent_term:get(?POOL_REGISTRY_KEY, undefined) of |
395 | | - undefined -> []; |
396 | | - Registry when is_map(Registry) -> |
397 | | - %% Extract unique pool names from registry values |
398 | | - lists:usort(maps:values(Registry)) |
399 | | - end, |
400 | | - %% Always include default pool, plus any registered pools |
401 | | - AllPools = lists:usort([default | RegisteredPools]), |
402 | | - %% Flush each pool |
403 | | - lists:foreach(fun(Pool) -> |
404 | | - case pool_started(Pool) of |
405 | | - true -> |
406 | | - Ctxs = contexts(Pool), |
407 | | - lists:foreach(fun(Ctx) -> |
408 | | - catch py_context:flush_imports(Ctx, Modules) |
409 | | - end, Ctxs); |
410 | | - false -> |
411 | | - ok |
412 | | - end |
413 | | - end, AllPools), |
414 | | - ok. |
415 | | - |
416 | 382 | %% ============================================================================ |
417 | 383 | %% Pool Registration (route module/func to specific pools) |
418 | 384 | %% ============================================================================ |
|
0 commit comments