mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
fix: cancel Proton seed downloads promptly
This commit is contained in:
1 parent
c02832ac59
commit
0ab2172857
3 files changed
+25
-4
No files matched your search
@@ -201,15 +201,18 @@ class DownloaderResumeTest {
|
||||
holdAfterFirstChunk = true
|
||||
val cancellation = Downloader.Cancellation()
|
||||
val executor = Executors.newSingleThreadExecutor()
|
||||
val cancelExecutor = Executors.newSingleThreadExecutor()
|
||||
try {
|
||||
val result = executor.submit<Boolean> { Downloader.downloadFile(url, target, true, null, cancellation, null) }
|
||||
assertTrue("server sent the first chunk", bodyStarted.await(2, TimeUnit.SECONDS))
|
||||
cancellation.cancel()
|
||||
val cancelled = cancelExecutor.submit { cancellation.cancel() }
|
||||
cancelled.get(2, TimeUnit.SECONDS)
|
||||
assertFalse("cancelled download", result.get(2, TimeUnit.SECONDS))
|
||||
assertEquals(listOf<String?>(null), requests.toList())
|
||||
} finally {
|
||||
continueBody.countDown()
|
||||
executor.shutdownNow()
|
||||
cancelExecutor.shutdownNow()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user