Skip to content

FR: Storage - use NSProgress objects properly when reporting progress, not re-initting them every time #5973

Open
@xaphod

Description

@xaphod

[READ] Guidelines

Feature proposal

  • Firebase Component: Storage

In FIRStorageTask.m there's this code for reporting progress:

- (FIRStorageTaskSnapshot *)snapshot {
  @synchronized(self) {
    NSProgress *progress = [NSProgress progressWithTotalUnitCount:self.progress.totalUnitCount];

A new NSProgress object is created every time there's a snapshot. This makes it impossible to use NSProgress objects how they are often used: they get added as a child of another NSProgress object, via NSProgress.addChild(...). That's because often one has lots of download tasks and wants to report overall/aggregate progress to the user -- and rather than having to calculate this every time something changes, one just observes a parent NSProgress object.

Ask: instead of making a new NSProgress object every time, please reuse one NSProgress object per task, specifically so we can add it as a child of a "parent" NSProgress object.

Bonus ask, worth 10,000 points: also support NSProgress' pause/unpause/cancel functionality, so we can easily tie in pausing multiple tasks at once

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions