Closed jay-athelas closed 5 days ago
After adding the elapsedTime callback I see that it keeps printing every 5 seconds and never finishes, but the upload has completed
Which platform(s) and versions and can you confirm if it happens on one platform (eg Android), it also happens on another (eg iOS)? Can you share the native logs (Console on iOS or Android logs)? And also, any other results from the print statement in your code, or does the upload complete without any progress or status updates?
I am currently testing only in iOS , yes the upload completes without progress or status updates, the elapsedTime callback keeps printing every 5 seconds
so basically nothing is printed after the upload is called, like it never finishes
TaskStatusUpdate result = await uploader.upload(uploadTask, onProgress: (progress) {
print("uploader: $progress");
}, onStatus: (TaskStatus status) {
print("uploader: ${status}");
},);
print("uploader: ${result.status}");
Can you provide native logs, using the iOS Console app, filtering on Category "Downloader" so I can see what the iOS side is doing?
Hi @781flyingdutchman, it's working now, I wonder how the retry works, the use case is if there is no internet connection it should retry, but can you setup the backoff? , I see in the logs there is no status updates for when is no connection, just says taskStatus.enqued, can you provide more insights into how this works for offline ?
Hi, glad it works. The downloader waits for an internet connection before starting a Task
, so no retry is required for that scenario. If the internet connection disappears while the task is running, then the task may fail (or pause, on iOS, without user notification as this is handled by the OS), and if it fails and retries have been set it will trigger a retry after an exponentially increasing delay (which cannot be set manually). That means it will then wait for an internet connection before re-attempting the task that failed, so the actual start of the task may be much later. Hope that clarifies, closing this issue.
"Hi, glad it works. The downloader waits for an internet connection before starting a
Task
, so no retry is required for that scenario. If the internet connection disappears while the task is running, then the task may fail (or pause, on iOS, without user notification as this is handled by the OS), and if it fails and retries have been set it will trigger a retry after an exponentially increasing delay (which cannot be set manually). That means it will then wait for an internet connection before re-attempting the task that failed, so the actual start of the task may be much later. Hope that clarifies, closing this issue."
Hello @781flyingdutchman - question... Can this 'exponentially increasing delay' on iOS be avoided by setting retries to 0 and forcing a pause/failure and handle the retry manually by establishing a new upload task for it? We have a similar situation... Thanks
If you set retries to 0 the task will still wait for a network connection before starting, and when the network disappears then on Android the task fails, whereas on iOS the task moves to a suspended state where the OS revives it when the network comes back. That is a feature of the iOS implementation of background downloads and not something you can override (you cannot force it to fail when the network disappears, though I believe it does fail if the server does not support resumable downloads).
I guess you could create some mechanism where if the progress updates are not coming through regularly (which would suggest a loss of internet connection) you cancel the task and reschedule it, but this would not be entirely predictable/robust.
Got it @781flyingdutchman. Thanks for the quick clarification response!
Describe the bug I am trying to upload a multipart audio file, the audio upload works fine but does not return any result, I want to test uploads when the app is not on foreground but rather minimized.
This is the code I have to upload.
Expected behavior It should print a status when task is completed
print("uploader: ${result.status}");
Logs If possible, include logs that capture the issue:
Any help will be highly appreciated! Thanks!