From 9c1ba2bea6d18e69755497974255eb88c02a4673 Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Thu, 24 Sep 2026 00:45:56 +0000 Subject: [PATCH] drop the artwork seed expiry --- .../4.json | 25 +++---------------- .../com/subtracks/data/db/ArtworkSeedDao.kt | 3 --- .../com/subtracks/data/db/Migrations.kt | 3 +-- .../kotlin/com/subtracks/data/model/Models.kt | 3 +-- .../data/repo/ArtworkSeedRepository.kt | 9 +------ 5 files changed, 7 insertions(+), 36 deletions(-) diff --git a/app/schemas/com.subtracks.data.db.SubtracksDatabase/4.json b/app/schemas/com.subtracks.data.db.SubtracksDatabase/4.json index 4e939798..9ad3b4d3 100644 --- a/app/schemas/com.subtracks.data.db.SubtracksDatabase/4.json +++ b/app/schemas/com.subtracks.data.db.SubtracksDatabase/4.json @@ -2,7 +2,7 @@ "formatVersion": 1, "database": { "version": 4, - "identityHash": "9ee801b55a0e0e6a8b240d867c3a4e58", + "identityHash": "5c2180369cf0981302f79ec4e77187fd", "entities": [ { "tableName": "sources", @@ -721,7 +721,7 @@ }, { "tableName": "artwork_seeds", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cacheKey` TEXT NOT NULL, `primary` INTEGER NOT NULL, `secondary` INTEGER, `updatedAt` INTEGER NOT NULL, PRIMARY KEY(`cacheKey`))", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cacheKey` TEXT NOT NULL, `primary` INTEGER NOT NULL, `secondary` INTEGER, PRIMARY KEY(`cacheKey`))", "fields": [ { "fieldPath": "cacheKey", @@ -739,12 +739,6 @@ "fieldPath": "secondary", "columnName": "secondary", "affinity": "INTEGER" - }, - { - "fieldPath": "updatedAt", - "columnName": "updatedAt", - "affinity": "INTEGER", - "notNull": true } ], "primaryKey": { @@ -752,23 +746,12 @@ "columnNames": [ "cacheKey" ] - }, - "indices": [ - { - "name": "index_artwork_seeds_updatedAt", - "unique": false, - "columnNames": [ - "updatedAt" - ], - "orders": [], - "createSql": "CREATE INDEX IF NOT EXISTS `index_artwork_seeds_updatedAt` ON `${TABLE_NAME}` (`updatedAt`)" - } - ] + } } ], "setupQueries": [ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", - "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '9ee801b55a0e0e6a8b240d867c3a4e58')" + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '5c2180369cf0981302f79ec4e77187fd')" ] } } \ No newline at end of file diff --git a/app/src/main/kotlin/com/subtracks/data/db/ArtworkSeedDao.kt b/app/src/main/kotlin/com/subtracks/data/db/ArtworkSeedDao.kt index e38d5eed..d45d80c8 100644 --- a/app/src/main/kotlin/com/subtracks/data/db/ArtworkSeedDao.kt +++ b/app/src/main/kotlin/com/subtracks/data/db/ArtworkSeedDao.kt @@ -12,7 +12,4 @@ interface ArtworkSeedDao { @Upsert suspend fun upsert(seed: ArtworkSeed) - - @Query("DELETE FROM artwork_seeds WHERE updatedAt < :cutoff") - suspend fun pruneExpired(cutoff: Long) } diff --git a/app/src/main/kotlin/com/subtracks/data/db/Migrations.kt b/app/src/main/kotlin/com/subtracks/data/db/Migrations.kt index 7227022e..1c38fb2c 100644 --- a/app/src/main/kotlin/com/subtracks/data/db/Migrations.kt +++ b/app/src/main/kotlin/com/subtracks/data/db/Migrations.kt @@ -39,10 +39,9 @@ val MIGRATION_3_4 = override suspend fun migrate(connection: SQLiteConnection) { connection.execSQL( "CREATE TABLE IF NOT EXISTS `artwork_seeds` (`cacheKey` TEXT NOT NULL, " + - "`primary` INTEGER NOT NULL, `secondary` INTEGER, `updatedAt` INTEGER NOT NULL, " + + "`primary` INTEGER NOT NULL, `secondary` INTEGER, " + "PRIMARY KEY(`cacheKey`))", ) - connection.execSQL("CREATE INDEX IF NOT EXISTS `index_artwork_seeds_updatedAt` ON `artwork_seeds` (`updatedAt`)") } } diff --git a/app/src/main/kotlin/com/subtracks/data/model/Models.kt b/app/src/main/kotlin/com/subtracks/data/model/Models.kt index 8eb0ed23..bcdb1c20 100644 --- a/app/src/main/kotlin/com/subtracks/data/model/Models.kt +++ b/app/src/main/kotlin/com/subtracks/data/model/Models.kt @@ -209,12 +209,11 @@ data class PlaybackCursor( val queuePosition: Long, ) -@Entity(tableName = "artwork_seeds", indices = [Index("updatedAt")]) +@Entity(tableName = "artwork_seeds") data class ArtworkSeed( @PrimaryKey val cacheKey: String, val primary: Int, val secondary: Int?, - val updatedAt: Long, ) class QueueKindConverter { diff --git a/app/src/main/kotlin/com/subtracks/data/repo/ArtworkSeedRepository.kt b/app/src/main/kotlin/com/subtracks/data/repo/ArtworkSeedRepository.kt index bcc6fadb..f5739a2a 100644 --- a/app/src/main/kotlin/com/subtracks/data/repo/ArtworkSeedRepository.kt +++ b/app/src/main/kotlin/com/subtracks/data/repo/ArtworkSeedRepository.kt @@ -24,13 +24,6 @@ class ArtworkSeedRepository( cacheKey: String, seeds: Pair, ) { - val dao = db.artworkSeedDao() - val now = System.currentTimeMillis() - dao.upsert(ArtworkSeed(cacheKey, seeds.first, seeds.second, now)) - dao.pruneExpired(now - MAX_AGE_MS) - } - - private companion object { - const val MAX_AGE_MS = 30L * 24 * 60 * 60 * 1000 + db.artworkSeedDao().upsert(ArtworkSeed(cacheKey, seeds.first, seeds.second)) } }