Skip to content

Conversation

@devnoname120
Copy link
Contributor

  • 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 written new tests for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

Summary

This PR adds support for the macOS-only ThrottleInterval option in Homebrew services. There is no equivalent for systemd.

This PR is a follow up to #21088
It aims to fix the other half of #14931

Changes

  • Added throttle_interval method to Service class
  • Added ThrottleInterval in to_plist method for macOS launchd plist generation
  • Added throttle_interval to to_hash and from_hash methods for API serialization
  • Added tests covering:
    • Valid throttle_interval values (including zero)
    • Verification that ThrottleInterval appears in generated launchd plist
  • Updated documentation in Formula-Cookbook.md

Motivation

Previously, Homebrew services supported Apple launchd services which could be configured with ThrottleInterval. But with the switch to a custom syntax it became impossible to define a ThrottleInterval value. This PR restores this macOS-only functionality.

Copilot AI review requested due to automatic review settings November 17, 2025 00:59
@devnoname120
Copy link
Contributor Author

cc @MikeMcQuaid

Copy link
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 adds support for the macOS-specific ThrottleInterval option in Homebrew services, which specifies the minimum number of seconds to wait between service invocations. This restores functionality that was lost when Homebrew moved from raw launchd plists to a custom service DSL.

Key changes:

  • Added throttle_interval method to the Service class for macOS launchd configuration
  • Implemented proper handling of zero values (explicitly tested and supported per launchd behavior)
  • Extended API serialization to include throttle_interval in service hash representations

Reviewed Changes

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

File Description
docs/Formula-Cookbook.md Documents the new throttle_interval option in the service configuration table, noting it's macOS-specific and defaults to 10 seconds
Library/Homebrew/service.rb Implements throttle_interval method, adds instance variable, integrates with plist generation, and includes in API serialization (to_hash/from_hash)
Library/Homebrew/test/service_spec.rb Adds comprehensive test coverage for throttle_interval including valid values, zero handling, plist generation, and unset behavior

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

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks again @devnoname120, looks good!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Nov 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Nov 18, 2025
Copilot AI review requested due to automatic review settings November 18, 2025 10:32
Copy link
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 3 out of 3 changed files in this pull request and generated no new comments.


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

@devnoname120
Copy link
Contributor Author

@MikeMcQuaid I fixed the conflicts :)

@devnoname120
Copy link
Contributor Author

@MikeMcQuaid Looks like it needs to be added again to the merge queue

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Nov 18, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 18, 2025
@devnoname120
Copy link
Contributor Author

@MikeMcQuaid The dead link checker failed because Cloudflare is down

@devnoname120
Copy link
Contributor Author

@MikeMcQuaid Sorry for the spam — Cloudflare seems to have recovered. Could you add the PR again to the queue?

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Nov 19, 2025
@MikeMcQuaid
Copy link
Member

@devnoname120 No apologies needed, appreciate the responsiveness!

Merged via the queue into Homebrew:main with commit 27295b6 Nov 19, 2025
42 checks passed
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.

2 participants