@@ -20,8 +20,7 @@ def process_cargo_packages(cargo_repo, fed_repo, fed_conf_repo, logger):
2020 """
2121 Process Cargo index files commit by commit.
2222 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
2524 - when reaching HEAD.
2625 """
2726
@@ -40,6 +39,7 @@ def process_cargo_packages(cargo_repo, fed_repo, fed_conf_repo, logger):
4039 )
4140 logger (f"Found { len (changed_files )} changed files in Cargo index." )
4241
42+ file_counter = 0
4343 for idx , rel_path in enumerate (changed_files ):
4444 file_path = base_path / rel_path
4545 logger (f"Found { file_path } ." )
@@ -49,13 +49,15 @@ def process_cargo_packages(cargo_repo, fed_repo, fed_conf_repo, logger):
4949
5050 if file_path .name in {"config.json" , "README.md" , "update-dl-url.yml" }:
5151 continue
52+
5253 packages = []
5354 with open (file_path , encoding = "utf-8" ) as f :
5455 for line in f :
5556 if line .strip ():
5657 packages .append (json .loads (line ))
5758
58- push_commit = idx == len (changed_files )
59+ file_counter += 1
60+ push_commit = (file_counter % 1000 == 0 ) or (idx == len (changed_files ))
5961 store_cargo_packages (packages , fed_repo , push_commit )
6062
6163 update_last_commit (next_commit , fed_conf_repo , "cargo" )
0 commit comments