Ensure old extension store is removed if index url changes (#3408)
This commit is contained in:
@@ -39,7 +39,14 @@ class ExtensionStoreRepositoryImpl(
|
|||||||
try {
|
try {
|
||||||
database.extension_storeQueries.getAll().awaitAsList().forEach { store ->
|
database.extension_storeQueries.getAll().awaitAsList().forEach { store ->
|
||||||
service.fetch(store.index_url)
|
service.fetch(store.index_url)
|
||||||
.mapCatching { upsert(it) }
|
.mapCatching {
|
||||||
|
database.transaction {
|
||||||
|
upsert(it)
|
||||||
|
if (store.index_url != it.indexUrl) {
|
||||||
|
database.extension_storeQueries.delete(store.index_url)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.onFailure {
|
.onFailure {
|
||||||
logcat(LogPriority.ERROR, it) {
|
logcat(LogPriority.ERROR, it) {
|
||||||
"Failed to refresh extension store '${store.name} (${store.index_url})'"
|
"Failed to refresh extension store '${store.name} (${store.index_url})'"
|
||||||
|
|||||||
Reference in New Issue
Block a user