Skip to content

Commit ef57504

Browse files
committed
fix(repos): Call repo sync batch tasks
Follow up to #113131. This fires off the tasks rather than calling them directly.
1 parent a6ce51e commit ef57504

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/sentry/integrations/source_code_management/sync_repos.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,24 +198,29 @@ def sync_repos_for_org(organization_integration_id: int) -> None:
198198
removed_id_list = list(removed_ids)
199199
restored_id_list = list(restored_ids)
200200

201-
# TODO: Switch to apply_async once the tasks are deployed to all workers
202201
for config_batch in chunked(new_repo_configs, SYNC_BATCH_SIZE):
203-
create_repos_batch(
204-
organization_integration_id=organization_integration_id,
205-
repo_configs=config_batch,
202+
create_repos_batch.apply_async(
203+
kwargs={
204+
"organization_integration_id": organization_integration_id,
205+
"repo_configs": config_batch,
206+
}
206207
)
207208

208209
if _has_feature("organizations:scm-repo-auto-sync-removal", rpc_org):
209210
for removed_batch in chunked(removed_id_list, SYNC_BATCH_SIZE):
210-
disable_repos_batch(
211-
organization_integration_id=organization_integration_id,
212-
external_ids=removed_batch,
211+
disable_repos_batch.apply_async(
212+
kwargs={
213+
"organization_integration_id": organization_integration_id,
214+
"external_ids": removed_batch,
215+
}
213216
)
214217

215218
for restored_batch in chunked(restored_id_list, SYNC_BATCH_SIZE):
216-
restore_repos_batch(
217-
organization_integration_id=organization_integration_id,
218-
external_ids=restored_batch,
219+
restore_repos_batch.apply_async(
220+
kwargs={
221+
"organization_integration_id": organization_integration_id,
222+
"external_ids": restored_batch,
223+
}
219224
)
220225

221226

0 commit comments

Comments
 (0)