fix(battlenet): a download that stops moving ends with Retry, and a killed update comes back as an update (#2602)

* fix(battlenet): a Battle.net download that stops moving ends as retryable, and a killed update comes back as an update

A job reply without a state or byte counts no longer counts as a started
download, and an Agent job that reports no change for ten minutes is
stopped with its Agent and fails with a Retry instead of waiting forever.
Updates remember their game folder in the saved queue, so one restored
after the app was closed runs agent-update on that folder instead of a
fresh install.

* fix(battlenet): a stalled job stops only the Agent it started

A game or Battle.net client running in the prefix keeps running when a
stalled Agent job is ended, and the progress test keeps the job alive
across polls with a controlled clock.

* fix(battlenet): only real progress holds off the stall timeout

The download rate and time estimate can change while no bytes move, so
the stall timer now resets only on byte counts, progress, state, phase,
pause or error.

* test(battlenet): bound the stalled-rate fake child's polls
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-14 10:58:42 -05:00
1 parent 84b7295f11
commit d8b3c66b95
38 files changed
+218 -6

No files matched your search

@@ -2,12 +2,15 @@ package com.droiddeck.launcher.stores.battlenet
import com.droiddeck.launcher.runtime.BattleNet
import com.droiddeck.launcher.stores.CatalogItem
import com.droiddeck.launcher.stores.InstalledStoreGame
import com.droiddeck.launcher.stores.Store
import com.droiddeck.launcher.stores.StoreGameSidecar
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
import java.io.File
import java.nio.file.Files
import java.util.Locale
@@ -89,4 +92,13 @@ class BattleNetInstallTest {
assertEquals(BattleNetInstall.Step.APPLYING, BattleNetInstall.step(1003, 2000, 1, 9))
assertEquals(BattleNetInstall.Step.APPLYING, BattleNetInstall.step(1004, 1000, 0, 0))
}
@Test fun aSavedUpdateComesBackAsAnUpdateOfItsOwnFolder() {
val folder = File("/data/Games/Stores/Battle.net/World of Warcraft")
val game = InstalledStoreGame(StoreGameSidecar(Store.BATTLENET, "wow", "World of Warcraft", "Wow.exe"), folder)
val item = BattleNetInstall.updateItem(game, "wow_enus")
assertEquals("wow_enus", item.extra[BattleNetInstall.INSTALL_UID])
assertEquals(folder, BattleNetInstall.updateFolder(item))
assertNull(BattleNetInstall.updateFolder(CatalogItem(Store.BATTLENET, "wow", "World of Warcraft", null)))
}
}