Skip to content
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

fix: out of memory error when uploading large assets on slow internet #224

Merged
merged 5 commits into from
Jun 18, 2022

Conversation

zackpollard
Copy link
Contributor

@zackpollard zackpollard commented Jun 14, 2022

This is a fix for an out of memory exception caused by uploading large assets on slow internet. Size of asset that would cause this varies based on the device.
This should should fix #54 and fix #190

'assetData': [assetRawUploadData]
});
if(thumbnailUploadData != null) {
req.files.add(thumbnailUploadData);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this, it makes the code cleaner

@alextran1502
Copy link
Contributor

So the cancelation mechanism is not implemented for http package for dart, see here dart-lang/http#424

The most sensible way is to set a boolean to return the function after the current asset is finished uploading.

This is a trade-off to handle the crashing issue and I think the trade-off is something we can live with until they have better implementation of the http package.

@alextran1502
Copy link
Contributor

It might be good to implement this library which uses Dio and uploads large files in chunk https://github.com/Taskulu/chunked_uploader/blob/master/lib/chunked_uploader.dart to keep all the functionality of Dio

@zackpollard zackpollard force-pushed the fix/out-of-memory-asset-backup branch from 11d88cd to b42082c Compare June 18, 2022 00:05
@alextran1502
Copy link
Contributor

I fixed a bug that after canceling the upload, it keeps looping once catching the error. This is good for merging now.

@zackpollard zackpollard marked this pull request as ready for review June 18, 2022 07:53
@alextran1502 alextran1502 merged commit e6efc61 into main Jun 18, 2022
@alextran1502 alextran1502 deleted the fix/out-of-memory-asset-backup branch June 21, 2022 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Backup gets stuck on Video iOS app crashes during upload
2 participants