Skip to content

Commit 89505de

Browse files
prevent race condition when syncing certain repos
Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent 72faa2c commit 89505de

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

app/src/main/kotlin/com/fox2code/mmm/repo/RepoManager.kt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,27 @@ class RepoManager private constructor(mainApplication: MainApplication) : SyncMa
189189
repoModule.propUrl!!, false
190190
)
191191
)
192+
193+
if (repoData.tryLoadMetadata(repoModule) && (allowLowQualityModules || !isLowQualityModule(
194+
repoModule.moduleInfo
195+
))
196+
) {
197+
// Note: registeredRepoModule may not be null if registered by multiple repos
198+
val registeredRepoModule = modules[repoModule.id]
199+
if (registeredRepoModule == null) {
200+
modules[repoModule.id] = repoModule
201+
} else if (instance.isEnabled && registeredRepoModule.repoData === androidacyRepoData) {
202+
// empty
203+
} else if (instance.isEnabled && repoModule.repoData === androidacyRepoData) {
204+
modules[repoModule.id] = repoModule
205+
} else if (repoModule.moduleInfo.versionCode > registeredRepoModule.moduleInfo.versionCode) {
206+
modules[repoModule.id] = repoModule
207+
}
208+
} else {
209+
repoModule.moduleInfo.flags =
210+
repoModule.moduleInfo.flags or ModuleInfo.FLAG_METADATA_INVALID
211+
}
212+
return@execute
192213
}
193214
}
194215
if (repoData.tryLoadMetadata(repoModule) && (allowLowQualityModules || !isLowQualityModule(

0 commit comments

Comments
 (0)