perf: After optimizing the execution of the azure vault task, the data is out of sync

This commit is contained in:
halo
2024-11-26 09:50:17 +08:00
committed by feng626
parent d0617a0ea4
commit 801edc7cc9
3 changed files with 2 additions and 5 deletions

View File

@@ -52,7 +52,8 @@ def sync_secret_to_vault():
for model in to_sync_models:
instances += list(model.objects.all())
with ThreadPoolExecutor(max_workers=10) as executor:
max_workers = 1 if VaultTypeChoices.azure == vault_client.type else max_workers = 10
with ThreadPoolExecutor(max_workers=max_workers) as executor:
tasks = [executor.submit(sync_instance, instance) for instance in instances]
for future in as_completed(tasks):