summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/org/terst/listen/work/Workers.kt14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/src/main/java/org/terst/listen/work/Workers.kt b/app/src/main/java/org/terst/listen/work/Workers.kt
index 5e1bcad..88747fe 100644
--- a/app/src/main/java/org/terst/listen/work/Workers.kt
+++ b/app/src/main/java/org/terst/listen/work/Workers.kt
@@ -155,9 +155,17 @@ object Scheduling {
PeriodicWorkRequestBuilder<RefreshWorker>(REFRESH_HOURS, TimeUnit.HOURS)
.setConstraints(
Constraints.Builder()
- // Unmetered: refreshing every feed is cheap, but downloads that follow
- // are not, and a phone on mobile data should not discover that by itself.
- .setRequiredNetworkType(NetworkType.UNMETERED)
+ // Any connection, not just unmetered. A refresh is conditional -- every
+ // request carries If-None-Match and If-Modified-Since -- so an unchanged
+ // feed is a 304 with no body, and a whole sweep is a few hundred bytes a
+ // show. Waiting for Wi-Fi to spend that leaves the library silently
+ // stale, which is how a failed refresh from hours ago came to be the
+ // thing on screen.
+ //
+ // This used to be UNMETERED, and the reason given was not the refresh
+ // itself: "downloads that follow are not [cheap]". That guard belongs on
+ // the downloads, and it is on them -- see DOWNLOAD_WORK below.
+ .setRequiredNetworkType(NetworkType.CONNECTED)
.build()
)
.build(),