Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

Improves progress percent calculation #259

Merged
merged 3 commits into from
Oct 12, 2018

Conversation

zwaldowski
Copy link
Contributor

@zwaldowski zwaldowski commented Oct 6, 2018

What's in this pull request?

Fixes two related problems:

  • The Progress returned by URLSessionUploadTask has a fraction like "(0 / 2)". Task would use only that fraction when a Task using that Progress was then maped or andThened, not reflecting the actual percentage of URLSession's internals.
  • Doing a trivial map (f.ex., unwrapping some result) has an outsized effect on the end task, causing a progress bar to smoothly use 50% a network request loads, then leaping the remaining 50% as the trivial code gets executed.

Testing

This affects the behavior of UI presentation, which wasn't adequately under test.

  • Attempt better coverage

API Changes

None.

Improves a case where mapping a task over URLSessionTask's progress
produces progress that doesn't smoothly change as the underlying work
progresses.
@zwaldowski zwaldowski force-pushed the zwaldowski/better-progress-percents branch 3 times, most recently from bed7a77 to fe0ec7c Compare October 11, 2018 23:11
Improves a where syntax-only map and andThen (f.ex., unwrapping a tuple)
would have an outsized effect on the task progress.
@zwaldowski zwaldowski force-pushed the zwaldowski/better-progress-percents branch from fe0ec7c to 306782a Compare October 11, 2018 23:46
@zwaldowski zwaldowski changed the title [WIP] Improves progress percent calculation Improves progress percent calculation Oct 12, 2018
@zwaldowski zwaldowski merged commit d653e83 into master Oct 12, 2018
@zwaldowski zwaldowski deleted the zwaldowski/better-progress-percents branch October 12, 2018 20:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant