Skip to content

Commit 9cdb95c

Browse files
Ilija VukoticBenGalewsky
authored andcommitted
this should improve coverage
1 parent 7479c5e commit 9cdb95c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/servicex_did_finder_lib/servicex_adaptor.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,7 @@
3232

3333

3434
MAX_RETRIES = 3
35-
36-
37-
def chunks(lst, n):
38-
"""Yield successive n-sized chunks from lst."""
39-
for i in range(0, len(lst), n):
40-
yield lst[i:i + n]
35+
CH_LEN = 30
4136

4237

4338
class ServiceXAdapter:
@@ -98,7 +93,10 @@ def put_file_add(self, file_info):
9893
f'message: {str(file_info)} - Ignoring error.')
9994

10095
def put_file_add_bulk(self, file_list):
101-
for chunk in chunks(file_list, 30):
96+
# we first chunk up file_list as it can be very large in
97+
# case there are a lot of replicas and a lot of files.
98+
chunks = [file_list[i:i + CH_LEN] for i in range(0, len(file_list), CH_LEN)]
99+
for chunk in chunks:
102100
success = False
103101
attempts = 0
104102
mesg = []

0 commit comments

Comments
 (0)