Fetch: Shorten "onUpdate" interval

Created on 26 Jun 2017  路  7Comments  路  Source: tonyofrancis/Fetch

Hi

First, thank you for some nice coding. Very helpful and elegant.

Secondly, I was wondering if there was any specific reason to restrict onUpdate calls to 2 seconds?

I'm using Fetch to download some smaller files.
Because of a somewhat higher network speed, I only see this sequence:
1. Enqueue download
2. 100% progress.

This is because the update interval is set to the Utils.hasTwoSecondsPassed(...) and my download takes less than that time.

Wouldn't it be possible and preferable to be able to set/override the desired update duration?


Please see PR: https://github.com/tonyofrancis/Fetch/pull/61

Most helpful comment

Would also appreciate this PR :)

All 7 comments

@Mithrandir21 Thanks.
Being that the FetchListeners are updated on the UI thread you do not want to bombard the UI thread with updates causing it to be sloooowww. If the file is a few megs its reasonable to show 100% if it takes less than a second on a really fast network.

I would also very much welcome the possibility to override the default time.

Would also appreciate this PR :)

@tonyofrancis You are right, we should not be attempting to update the UI with progress updates faster than the UI can actual perform them, but shouldn't this option be available to the developer in case they have such a need?
I've set mine to 500ms and it seems reasonably fast. 2 updates every 1000ms is not all that crazy. 馃槃

@Mithrandir21 Your pull request looked fine expect for one issue I commented on. Please review.

this is merged and will make it in next release

New version with this changed has been released. 1.1.3

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Moeinh77 picture Moeinh77  路  4Comments

burhanaksendir picture burhanaksendir  路  3Comments

jpvs0101 picture jpvs0101  路  5Comments

jpvs0101 picture jpvs0101  路  5Comments

DeevD picture DeevD  路  3Comments