mirror of
https://github.com/mihonapp/mihon.git
synced 2026-10-20 07:32:28 -07:00
Don't bring back extension stores removed during a refresh
A store's refreshed details are written only if the store still exists when its fetch returns, so one removed while its index was loading stays removed. The unused get query becomes contains.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package mihon.data.extension.repository
|
||||
|
||||
import app.cash.sqldelight.async.coroutines.awaitAsList
|
||||
import app.cash.sqldelight.async.coroutines.awaitAsOne
|
||||
import dev.zacsweers.metro.AppScope
|
||||
import dev.zacsweers.metro.ContributesBinding
|
||||
import dev.zacsweers.metro.Inject
|
||||
@@ -49,6 +50,9 @@ class ExtensionStoreRepositoryImpl(
|
||||
service.fetch(store.index_url)
|
||||
.mapCatching {
|
||||
database.transaction {
|
||||
if (!database.extension_storeQueries.contains(store.index_url).awaitAsOne()) {
|
||||
return@transaction
|
||||
}
|
||||
upsert(it)
|
||||
if (store.index_url != it.indexUrl) {
|
||||
database.extension_storeQueries.delete(store.index_url)
|
||||
|
||||
Reference in New Issue
Block a user