Your app’s role here is really about taking "reasonable" precautions (for example, immediatelyAvailableMetadataOnly isn't a bad option) and providing the user clear feedback about what you "did" (so the user can figure out if something went wrong).
That makes sense as a philosophy to keep in the back of my head, thanks.
I think using Task() for I/O work like this is probably a mistake.
Ah, my mistake, I should’ve clarified that this would all be running inside a single actor, so the resulting behavior should be equivalent to an NSOperationQueue with a width of 1.
However, if your goal is to actually maximize I/O, then what you really need is GCD's behavior (so you can use the CPU for "other stuff") but constrained to a much more reasonable number of threads (probably somewhere between "4" and "10").
I’ll make sure to keep this in mind when I start profiling.
The problem with that is that each of those pending coordination requests consumes a Mach port
Would this maybe be solved by reusing a single NSFileCoordinator() or by passing file access intents to coordinate(with:) in batches (as suggested by the docs)? Should I be doing that anyway? I’d rather avoid using the synchronous coordination API.
Topic:
App & System Services
SubTopic:
Processes & Concurrency
Tags: