-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for submitting data without creating files #304
Comments
Good idea and not the first one to request it. The issue is iOS, but I'll consider this for a future update as I do think there's a workaround. |
I figured the iOS one could be a problem. But perhaps you could hide file manipulations from that special task. E.g. create a temp file for uploading using provided post payload and then clean it when task is completed. |
Yes that's exactly what I'm thinking of. It would be a subclass of UploadTask that doesn't take the file etc parameters but only |
Do you think it will be possible to keep track of task updates/failures even if/when app goes to background? If I'm not mistaken the download task is looking at the downloaded files to update task statuses when getting back to foregorund. |
If a upload fails (and this would essentially be an upload, we just mask the temp file handling) then you would get a |
Hi, can you help test this? Change your pubspec.yaml to:
and test creating and enqueueing a |
I'm on it! By the way, how do you recommend to query pending/failed tasks? E.g. Also, when having persistent storage enabled, what is the recommended way to clear completed tasks? E.g. once task is completed I need to clear it out immediately. But failed tasks (including tasks failed for business logic reasons) could stay there for X number of days and then cleared out after that. |
If you want to keep state around, you need to add persistent storage and use the database object. That also lets you delete tasks as needed |
I enabled persistent store. Though I only need to keep track of pending tasks and failures (including the failures based on response content even when http status is 200). And for that purpose the exposed Was wondering if persistent store has anything built in to do such cleanup. If not I'd have to run some kind of periodic job to clean it up, which would make things more complicated... Or if there some other mechanism I could use to keep track of pending and failed tasks? Even after restart of the app. |
You'd have to implement a persistent storage yourself, or take a look at
the `backfround_downloader_sql` package that has a sqlite based storage
that supports regular SQL queries.
…On Thu, May 9, 2024, 4:49 PM Eugene Kuleshov ***@***.***> wrote:
If you want to keep state around, you need to add persistent storage and
use the database object. That also lets you delete tasks as needed
I enabled persistent store. Though I only need to keep track of pending
tasks and failures (including the failures based on response content even
when http status is 200). And for that purpose the exposed Database api
is rather limiting.
Was wondering if persistent store has anything built in to do such
cleanup. If not I'd have to run some kind of periodic job to clean it up,
which would make things more complicated...
Or if there some other mechanism I could use to keep track of pending and
failed tasks? Even after restart of the app.
—
Reply to this email directly, view it on GitHub
<#304 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF5VCHZUAVR53V5SOMKN4HDZBPVPNAVCNFSM6AAAAABHNKZRN6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBTGQ3TANBXHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I was hoping there is some simpler way. Currently it is unclear how persistent store interact with notification listeners. E.g. is it safe to delete/update persistent tasks in the store from within listener? And if app goes from foreground, will registered listeners be called on updated/loaded tasks from the |
I verified on Android, iOS and MacOS with this branch. The new Sorry for derailing conversation in this request. I will try to submit some separate issues... |
Implemented in V8.5.0 with minor changes |
Is your feature request related to a problem? Please describe.
Currently there are task types that can be enqueued to upload or download files. There is also a
request
method for sending other server requests, but in my understanding it is executed immediately, for example it does not wait for wifi availability.It would be also handy to be able to enqueue regular server requests to submit some data to server and it would be great if we won't have to create files for that.
Describe the solution you'd like
Basically it would be really handy to have another task variant similar to
UploadTask
, but without having to provide afilename
,directory
andbaseDirectory
parameters and instead be able to pass the request data (binary or string) in theTask.post
parameter, similar toDownloadTask
. And when task is completed, the server response body would be available in theTaskStatusUpdate.responseBody
similar to theUploadTask
.Describe alternatives you've considered
Currently I have to use either
UploadTask
orDownloadTask
and have to create or delete temporary files.Additional context
N/A
The text was updated successfully, but these errors were encountered: