mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
logging: address review of the SQL logging path
Only downgrade a uniqueness conflict on an INSERT, so genuine duplicate-key failures still surface. Clear old zips from the dump directory before exporting, roll the log file over at midnight, prune on roll/day-change instead of on every line, and drop the unused files-path from the FileProvider config.
This commit is contained in:
@@ -152,10 +152,21 @@ class LogFileStoreTest {
|
||||
|
||||
@Test
|
||||
fun detectsUpsertConflictErrors() {
|
||||
assertTrue(isUpsertConflict(IllegalStateException("UNIQUE constraint failed: playback_cursor.id")))
|
||||
assertTrue(isUpsertConflict(IllegalStateException("Error code: 1555, message: UNIQUE constraint failed")))
|
||||
assertTrue(isUpsertConflict(IllegalStateException("SQLITE_CONSTRAINT_UNIQUE 2067")))
|
||||
assertFalse(isUpsertConflict(IllegalStateException("no such table: songs")))
|
||||
assertTrue(
|
||||
isUpsertConflict(
|
||||
"INSERT INTO playback_cursor (id) VALUES (?)",
|
||||
IllegalStateException("UNIQUE constraint failed: playback_cursor.id"),
|
||||
),
|
||||
)
|
||||
assertTrue(
|
||||
isUpsertConflict(
|
||||
"INSERT OR ABORT INTO t VALUES (?)",
|
||||
IllegalStateException("PRIMARY KEY constraint failed"),
|
||||
),
|
||||
)
|
||||
assertFalse(isUpsertConflict("UPDATE t SET x = 1", IllegalStateException("UNIQUE constraint failed: t.x")))
|
||||
assertFalse(isUpsertConflict("SELECT * FROM t", IllegalStateException("no such table: t")))
|
||||
assertFalse(isUpsertConflict("INSERT INTO t VALUES (?)", IllegalStateException("Error code: 1555")))
|
||||
}
|
||||
|
||||
private fun execution(
|
||||
|
||||
Reference in New Issue
Block a user