@@ -20,8 +20,7 @@ def process_cargo_packages(cargo_repo, fed_repo, fed_conf_repo, logger):
20
20
"""
21
21
Process Cargo index files commit by commit.
22
22
Push changes to fed_repo after:
23
- - every `commit_batch_size` commits, OR
24
- - every `file_batch_size` files, OR
23
+ - every `commit_batch` commits, OR
25
24
- when reaching HEAD.
26
25
"""
27
26
@@ -40,6 +39,7 @@ def process_cargo_packages(cargo_repo, fed_repo, fed_conf_repo, logger):
40
39
)
41
40
logger (f"Found { len (changed_files )} changed files in Cargo index." )
42
41
42
+ file_counter = 0
43
43
for idx , rel_path in enumerate (changed_files ):
44
44
file_path = base_path / rel_path
45
45
logger (f"Found { file_path } ." )
@@ -49,13 +49,15 @@ def process_cargo_packages(cargo_repo, fed_repo, fed_conf_repo, logger):
49
49
50
50
if file_path .name in {"config.json" , "README.md" , "update-dl-url.yml" }:
51
51
continue
52
+
52
53
packages = []
53
54
with open (file_path , encoding = "utf-8" ) as f :
54
55
for line in f :
55
56
if line .strip ():
56
57
packages .append (json .loads (line ))
57
58
58
- push_commit = idx == len (changed_files )
59
+ file_counter += 1
60
+ push_commit = (file_counter % 1000 == 0 ) or (idx == len (changed_files ))
59
61
store_cargo_packages (packages , fed_repo , push_commit )
60
62
61
63
update_last_commit (next_commit , fed_conf_repo , "cargo" )
0 commit comments