Skip to content

Commit

Permalink
V8.8.1 bug fix for timeout timer in Android
Browse files Browse the repository at this point in the history
  • Loading branch information
781flyingdutchman committed Dec 18, 2024
1 parent 8c7c00c commit 413db8e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 8.8.1

* Fixes Android bug where timeout timer is not cleaned up after use

## 8.8.0

* [iOS] Adds configuration option to exclude downloaded files from iCloud backup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.work.WorkManager
import androidx.work.WorkerParameters
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.NonCancellable
Expand All @@ -29,8 +30,6 @@ import java.net.InetSocketAddress
import java.net.Proxy
import java.net.SocketException
import java.net.URL
import java.util.Timer
import kotlin.concurrent.schedule
import kotlin.concurrent.write
import java.lang.Double.min as doubleMin

Expand Down Expand Up @@ -393,9 +392,9 @@ open class TaskWorker(
runInForegroundFileSize =
prefs.getInt(BDPlugin.keyConfigForegroundFileSize, -1)
withContext(Dispatchers.IO) {
Timer().schedule(taskTimeoutMillis) {
isTimedOut =
true // triggers .failed in [TransferBytes] method if not runInForeground
CoroutineScope(Dispatchers.Default).launch {
delay(taskTimeoutMillis)
isTimedOut = true
}
task = Json.decodeFromString(inputData.getString(keyTask)!!)
notificationConfigJsonString = inputData.getString(keyNotificationConfig)
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: background_downloader
description: A multi-platform background file downloader and uploader. Define the task, enqueue and monitor progress

version: 8.8.0
version: 8.8.1
repository: https://github.com/781flyingdutchman/background_downloader

environment:
Expand Down

0 comments on commit 413db8e

Please sign in to comment.