@@ -7,7 +7,7 @@ import { QueryExecutor } from '@crowd/data-access-layer/src/queryExecutor'
77import { getServiceChildLogger } from '@crowd/logging'
88
99import { normalizeScmUrl } from './extract'
10- import { writeRepoLink } from './runMavenEnrichmentLoop'
10+ import { withDeadlockRetry , writeRepoLink } from './runMavenEnrichmentLoop'
1111
1212const log = getServiceChildLogger ( 'maven-repo-url-backfill' )
1313
@@ -102,13 +102,15 @@ export async function backfillMavenRepositoryUrls(
102102 // re-run the row is skipped (its repository_url already matches `desired`),
103103 // so the inconsistency would never be repaired. On rollback the row stays
104104 // unchanged and is reprocessed on the next run.
105- await qx . tx ( async ( t ) => {
106- await updateMavenRepositoryUrls ( t , updates )
107- await deleteMavenPackageRepoLinks ( t , pruneTargets )
108- for ( const target of linkTargets ) {
109- await writeRepoLink ( t , target . id , target . repositoryUrl )
110- }
111- } )
105+ await withDeadlockRetry ( ( ) =>
106+ qx . tx ( async ( t ) => {
107+ await updateMavenRepositoryUrls ( t , updates )
108+ await deleteMavenPackageRepoLinks ( t , pruneTargets )
109+ for ( const target of linkTargets ) {
110+ await writeRepoLink ( t , target . id , target . repositoryUrl )
111+ }
112+ } ) ,
113+ )
112114 totals . pruned += pruneTargets . length
113115 totals . linked += linkTargets . length
114116 }
0 commit comments