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

Add throttling to download progress events #292

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

KleggerKoder
Copy link

Platforms affected

iOS and Android

Motivation and Context

Way too many progress events being fired and makes all the application side progress indicators bounce around and sometimes crash the app. I believe download speeds may have affected the number of updates as well.

Description

Added some throttling to reduce message rate to 1/100th what it use to.

Testing

1/100th seemed reasonable for downloading a variety of small and large files on fast connections.
Your experience may vary depending on connection speeds.

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

…e-transfer into apache-master

# Conflicts:
#	src/android/FileTransfer.java
@wilk-polarny
Copy link

Hi, I would like to suggest a different approach, since fixing the underlying Cordova issue is arduous.
Rather than always skipping 100 elements, I would suggest to:

a) Only emit computable events
b) compute and track the progress and only emit an event if the current progress changed significantly. For example, computer the progress %, and only emit an event every 1% - or once a certain amount of transferred bytes has been reached - based on the content length.

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.

None yet

3 participants