mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-10 23:21:59 +01:00
wire the sync fetch concurrency to a Settings option
The bound was only a constructor default with no production consumer. Add a "Sync concurrency" preference (Settings -> Network, default 4) and pass it through SourceRepository to SubsonicSource, so sync parallelism is tunable without a rebuild. Both the app-scoped source and the on-demand `activeMusicSource()` used by sync read the preference. - UserPreferences.syncConcurrency()/setSyncConcurrency() (clamped >= 1) - SourceRepository combines the preference into toMusicSource - Settings row + dialog; SettingsViewModel state and setter - Preferences test for default/round-trip/clamp
This commit is contained in:
@@ -58,6 +58,24 @@ class UserPreferencesTest {
|
||||
file.delete()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun syncConcurrencyDefaultsAndClampsToAtLeastOne() =
|
||||
runTest {
|
||||
val file = File.createTempFile("user-prefs", ".preferences_pb").apply { delete() }
|
||||
val store = PreferenceDataStoreFactory.create(scope = backgroundScope) { file }
|
||||
val prefs = UserPreferences(store)
|
||||
|
||||
assertEquals(DEFAULT_SYNC_CONCURRENCY, prefs.syncConcurrency().first())
|
||||
|
||||
prefs.setSyncConcurrency(8)
|
||||
assertEquals(8, prefs.syncConcurrency().first())
|
||||
|
||||
prefs.setSyncConcurrency(0)
|
||||
assertEquals(1, prefs.syncConcurrency().first())
|
||||
|
||||
file.delete()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun lastSeedRoundTripsWithAndWithoutASecondary() =
|
||||
runTest {
|
||||
|
||||
@@ -306,10 +306,12 @@ class AppScreenshotTest {
|
||||
activeSourceId = 1,
|
||||
wifiQuality = StreamQuality(),
|
||||
mobileQuality = StreamQuality(192, "mp3"),
|
||||
syncConcurrency = 4,
|
||||
onSelectSource = {},
|
||||
onDeleteSource = {},
|
||||
onWifiQualityChange = {},
|
||||
onMobileQualityChange = {},
|
||||
onSyncConcurrencyChange = {},
|
||||
onAddServer = {},
|
||||
onBack = {},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user