This commit is contained in:
Syer10
2026-06-17 21:15:44 -04:00
parent 396cfa734a
commit 5b2613dad3

View File

@@ -125,24 +125,25 @@ object ExtensionStoreService {
ExtensionStoreTable.selectAll().toList() ExtensionStoreTable.selectAll().toList()
} }
var needsPrefUpdate = false var needsPrefUpdate = false
val updateStores = stores.mapNotNull { storeRow -> val updateStores =
val oldIndexUrl = storeRow[ExtensionStoreTable.indexUrl] stores.mapNotNull { storeRow ->
val oldName = storeRow[ExtensionStoreTable.name] val oldIndexUrl = storeRow[ExtensionStoreTable.indexUrl]
try { val oldName = storeRow[ExtensionStoreTable.name]
val store = fetch(oldIndexUrl) try {
if (store.indexUrl != oldIndexUrl) { val store = fetch(oldIndexUrl)
transaction { if (store.indexUrl != oldIndexUrl) {
ExtensionStoreTable.deleteWhere { ExtensionStoreTable.indexUrl eq oldIndexUrl } transaction {
ExtensionStoreTable.deleteWhere { ExtensionStoreTable.indexUrl eq oldIndexUrl }
}
needsPrefUpdate = true
} }
needsPrefUpdate = true upsert(store)
store
} catch (e: Exception) {
logger.warn(e) { "Failed to fetch extension store '$oldName ($oldIndexUrl)'" }
null
} }
upsert(store)
store
} catch (e: Exception) {
logger.warn(e) { "Failed to fetch extension store '$oldName ($oldIndexUrl)'" }
null
} }
}
if (needsPrefUpdate) syncDbToPrefs() if (needsPrefUpdate) syncDbToPrefs()
return updateStores return updateStores
} }