56
56
)
57
57
from async_substrate_interface .utils .storage import StorageKey
58
58
from async_substrate_interface .type_registry import _TYPE_REGISTRY
59
- from async_substrate_interface .utils .decoding_attempt import (
59
+ from async_substrate_interface .utils .decoding import (
60
60
decode_query_map ,
61
- _decode_scale_with_runtime ,
62
61
)
63
62
64
63
if TYPE_CHECKING :
65
64
from websockets .asyncio .client import ClientConnection
66
- from concurrent .futures import ProcessPoolExecutor
67
65
68
66
ResultHandler = Callable [[dict , Any ], Awaitable [tuple [dict , bool ]]]
69
67
@@ -418,7 +416,6 @@ def __init__(
418
416
last_key : Optional [str ] = None ,
419
417
max_results : Optional [int ] = None ,
420
418
ignore_decoding_errors : bool = False ,
421
- executor : Optional ["ProcessPoolExecutor" ] = None ,
422
419
):
423
420
self .records = records
424
421
self .page_size = page_size
@@ -431,7 +428,6 @@ def __init__(
431
428
self .params = params
432
429
self .ignore_decoding_errors = ignore_decoding_errors
433
430
self .loading_complete = False
434
- self .executor = executor
435
431
self ._buffer = iter (self .records ) # Initialize the buffer with initial records
436
432
437
433
async def retrieve_next_page (self , start_key ) -> list :
@@ -444,7 +440,6 @@ async def retrieve_next_page(self, start_key) -> list:
444
440
start_key = start_key ,
445
441
max_results = self .max_results ,
446
442
ignore_decoding_errors = self .ignore_decoding_errors ,
447
- executor = self .executor ,
448
443
)
449
444
if len (result .records ) < self .page_size :
450
445
self .loading_complete = True
@@ -2867,7 +2862,6 @@ async def query_map(
2867
2862
page_size : int = 100 ,
2868
2863
ignore_decoding_errors : bool = False ,
2869
2864
reuse_block_hash : bool = False ,
2870
- executor : Optional ["ProcessPoolExecutor" ] = None ,
2871
2865
) -> AsyncQueryMapResult :
2872
2866
"""
2873
2867
Iterates over all key-pairs located at the given module and storage_function. The storage
@@ -2972,54 +2966,16 @@ async def query_map(
2972
2966
if "error" in response :
2973
2967
raise SubstrateRequestException (response ["error" ]["message" ])
2974
2968
for result_group in response ["result" ]:
2975
- if executor :
2976
- # print(
2977
- # ("prefix", type("prefix")),
2978
- # ("runtime_registry", type(runtime.registry)),
2979
- # ("param_types", type(param_types)),
2980
- # ("params", type(params)),
2981
- # ("value_type", type(value_type)),
2982
- # ("key_hasher", type(key_hashers)),
2983
- # ("ignore_decoding_errors", type(ignore_decoding_errors)),
2984
- # )
2985
- result = await asyncio .get_running_loop ().run_in_executor (
2986
- executor ,
2987
- decode_query_map ,
2988
- result_group ["changes" ],
2989
- prefix ,
2990
- runtime .registry .registry ,
2991
- param_types ,
2992
- params ,
2993
- value_type ,
2994
- key_hashers ,
2995
- ignore_decoding_errors ,
2996
- )
2997
- # max_workers = executor._max_workers
2998
- # result_group_changes_groups = [result_group["changes"][i:i + max_workers] for i in range(0, len(result_group["changes"]), max_workers)]
2999
- # all_results = executor.map(
3000
- # self._decode_query_map,
3001
- # result_group["changes"],
3002
- # repeat(prefix),
3003
- # repeat(runtime.registry),
3004
- # repeat(param_types),
3005
- # repeat(params),
3006
- # repeat(value_type),
3007
- # repeat(key_hashers),
3008
- # repeat(ignore_decoding_errors)
3009
- # )
3010
- # for r in all_results:
3011
- # result.extend(r)
3012
- else :
3013
- result = decode_query_map (
3014
- result_group ["changes" ],
3015
- prefix ,
3016
- runtime .registry .registry ,
3017
- param_types ,
3018
- params ,
3019
- value_type ,
3020
- key_hashers ,
3021
- ignore_decoding_errors ,
3022
- )
2969
+ result = decode_query_map (
2970
+ result_group ["changes" ],
2971
+ prefix ,
2972
+ runtime ,
2973
+ param_types ,
2974
+ params ,
2975
+ value_type ,
2976
+ key_hashers ,
2977
+ ignore_decoding_errors ,
2978
+ )
3023
2979
return AsyncQueryMapResult (
3024
2980
records = result ,
3025
2981
page_size = page_size ,
@@ -3031,7 +2987,6 @@ async def query_map(
3031
2987
last_key = last_key ,
3032
2988
max_results = max_results ,
3033
2989
ignore_decoding_errors = ignore_decoding_errors ,
3034
- executor = executor ,
3035
2990
)
3036
2991
3037
2992
async def submit_extrinsic (
0 commit comments