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

Improve implicit progress handling in Task.map #267

Closed
zwaldowski opened this issue Nov 13, 2018 · 0 comments
Closed

Improve implicit progress handling in Task.map #267

zwaldowski opened this issue Nov 13, 2018 · 0 comments
Milestone

Comments

@zwaldowski
Copy link
Contributor

Lower-priority follow-up to #260, #265.

Ideally, progress objects created during a call to Task.map should participate in implicit progress composition: a map should take up 1 work unit by default, but 100 if a Progress is created using Progress.current() as a parent. This would have the benefit of working with Data reading and writing, Core Data fetches, as well as custom uses of implicit progress reporting.

I had a prototype like:

class Step: Progress {
    override func addChild(_ child: Progress, withPendingUnitCount pendingUnitCount: Int64) {
        setUserInfoObject(true, forKey: TaskChain.didAddChild)
        super.addChild(child, withPendingUnitCount: pendingUnitCount)
}

Then using didAddChild to perform the 1 or 100 check. But this doesn't work, because the work in the map is done by the time the map handler returns. Maybe this is as simple as moving the override to Root and making it do something immediately. I didn't investigate it further.

@zwaldowski zwaldowski added this to the 4.0 milestone Nov 13, 2018
@zwaldowski zwaldowski changed the title Improve handling of implicit progress handling in Task.map Improve implicit progress handling in Task.map Nov 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant