[Request]: Optimize MachineList command to fetch machines and default status concurrently
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
Research direction
Open Sources/ContainerCommands/Machine/MachineList.swift and inspect the run() method, especially the client.list() and client.getDefault() calls. Use Swift async let to start both operations concurrently while preserving the quiet and formatted-output behavior shown in the proposed solution. Done means the MachineList command fetches these values in parallel without changing its output behavior.
Written by the indexing model from the issue text.
Description
Feature or enhancement request details
Describe the feature / enhancement
In Sources/ContainerCommands/Machine/MachineList.swift, the run() method currently fetches the list of machines (client.list()) and the default machine (client.getDefault()) sequentially.
Using Swift's concurrency (async let), these two asynchronous operations can be executed in parallel to improve command performance and reduce execution latency.
Proposed Solution
Update the run() function to fetch both parameters concurrently:
public func run() async throws {
let client = MachineClient()
async let machinesTask = client.list()
async let defaultMachineTask = client.getDefault()
let machines = try await machinesTask
if self.quiet {
machines.forEach { print($0.id) }
return
}
let defaultMachine = try await defaultMachineTask
try printMachines(machines: machines, format: format, defaultMachine: defaultMachine)
}
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
- Dominant language
- Swift
- Stars
- 50.1k
- Forks
- 1.8k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apple/container
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
type: docs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
googleapis/google-cloud-swift#971 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mozilla-mobile/firefox-ios#35743 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
manaflow-ai/cmux#13417 ·
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
ionic-team/capacitor#8616 ·