Queue scrobbles offline and flush with WorkManager
When a submit fails for a transient reason (no connection, bad gateway, server error, rate limit) the scrobble is saved to a Room table and a network-constrained WorkManager job sends it later, in batches of 50, oldest first. Plays too old for the server are dropped, and a rejected session or unexpected error leaves the queue untouched. Safe to retry as the server dedupes on (user, played_at, artist, track). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ee34963799
commit
fa4eab47b3
15 files changed
+488
-12
No files matched your search
@@ -2,6 +2,7 @@ plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.kotlin.compose)
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
alias(libs.plugins.ksp)
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -51,8 +52,13 @@ dependencies {
|
||||
implementation(libs.okhttp)
|
||||
implementation(libs.kotlinx.serialization.json)
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
implementation(libs.androidx.room.runtime)
|
||||
implementation(libs.androidx.room.ktx)
|
||||
ksp(libs.androidx.room.compiler)
|
||||
implementation(libs.androidx.work.runtime.ktx)
|
||||
debugImplementation(libs.androidx.compose.ui.tooling)
|
||||
testImplementation(libs.junit)
|
||||
testImplementation(libs.androidx.work.testing)
|
||||
testImplementation(libs.okhttp.mockwebserver)
|
||||
testImplementation(libs.kotlinx.coroutines.test)
|
||||
androidTestImplementation(libs.androidx.espresso.core)
|
||||
|
||||
Reference in new issue
Block a user