Skip to content

Cleanup Download Queue#21638

Merged
MikeMcQuaid merged 1 commit intomainfrom
download_queue_cleanup
Mar 2, 2026
Merged

Cleanup Download Queue#21638
MikeMcQuaid merged 1 commit intomainfrom
download_queue_cleanup

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid commented Feb 27, 2026

  • cleanup various cases conditional on the download queue to always use it, now it's default and has been for a while
  • ensure that both casks and formulae are fetched at the same time when possible to maximise concurrency
  • generally DRY up the relevant download queue code

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

Generated through extensive prompting with OpenAI Codex. All code hand reviewed and in some cases edited. Manually tested and output and behaviour compared with main.


@MikeMcQuaid MikeMcQuaid marked this pull request as ready for review February 27, 2026 16:47
Copilot AI review requested due to automatic review settings February 27, 2026 16:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors Homebrew’s download-queue usage to make it the default path, reduce conditional branches, and improve concurrency by fetching formulae and casks together where possible.

Changes:

  • Refactors formula/cask fetching to enqueue downloads into a shared Homebrew::DownloadQueue for combined concurrent fetch.
  • Removes older “only use the download queue when concurrency > 1” logic and introduces new enqueue/prefetch helpers.
  • Updates API download helpers to support enqueuing downloads into a queue (enqueue:) and adjusts related call sites.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
Library/Homebrew/upgrade.rb Adds a fetch: toggle to allow skipping formula fetch when using prefetched downloads.
Library/Homebrew/install.rb Expands fetch_formulae into a configurable helper and adds enqueue/combined-heading helpers for shared-queue prefetching.
Library/Homebrew/formula_installer.rb Switches formula fetching to an “enqueue then queue.fetch” model and assumes a queue always exists.
Library/Homebrew/download_queue.rb Removes conditional constructor helper and adds a global default download-queue accessor.
Library/Homebrew/cmd/upgrade.rb Adds combined prefetch logic to fetch formulae and casks together with a shared download queue.
Library/Homebrew/cmd/reinstall.rb Adds combined prefetch logic for reinstalling formulae+casks with shared queue.
Library/Homebrew/cmd/install.rb Adds combined prefetch logic for installing formulae+casks with shared queue.
Library/Homebrew/cask/upgrade.rb Adds skip_prefetch/download_queue plumbing and adjusts upgrade fetch behavior.
Library/Homebrew/cask/reinstall.rb Adds skip_prefetch/download_queue plumbing for reinstall flow.
Library/Homebrew/cask/installer.rb Makes download_queue non-nilable and adds defer_fetch to separate downloading from installation.
Library/Homebrew/brew.rb Always prefetches API files when API installs are enabled (no longer gated by download concurrency).
Library/Homebrew/api/internal.rb Adds enqueue: support and requires a non-nil download queue default.
Library/Homebrew/api/formula.rb Adds enqueue: support to source/API fetch paths and removes queue params from some helpers.
Library/Homebrew/api/cask.rb Adds enqueue: support to source/API fetch paths and removes queue params from some helpers.
Library/Homebrew/api.rb Adds enqueue: support for JSON API downloads and always uses a download queue in fetch_api_files!.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MikeMcQuaid MikeMcQuaid force-pushed the download_queue_cleanup branch from 036e8d2 to 8ab8b1d Compare February 28, 2026 19:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- cleanup various cases conditional on the download queue to always
  use it, now it's default and has been for a while
- ensure that both casks and formulae are fetched at the same time
  when possible to maximise concurrency
- generally DRY up the relevant download queue code
@MikeMcQuaid MikeMcQuaid force-pushed the download_queue_cleanup branch from 49951e3 to c25ed8f Compare March 1, 2026 13:59
@MikeMcQuaid MikeMcQuaid marked this pull request as draft March 1, 2026 14:17
@MikeMcQuaid MikeMcQuaid marked this pull request as ready for review March 2, 2026 08:21
@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Mar 2, 2026
Merged via the queue into main with commit 81a6f05 Mar 2, 2026
38 checks passed
@MikeMcQuaid MikeMcQuaid deleted the download_queue_cleanup branch March 2, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants