-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Add ThrottleInterval option to service (macOS) #21095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ThrottleInterval option to service (macOS) #21095
Conversation
|
cc @MikeMcQuaid |
There was a problem hiding this 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_intervalmethod 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_intervalin 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.
MikeMcQuaid
left a comment
There was a problem hiding this 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!
…leinterval-option
There was a problem hiding this 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.
|
@MikeMcQuaid I fixed the conflicts :) |
|
@MikeMcQuaid Looks like it needs to be added again to the merge queue |
|
@MikeMcQuaid The dead link checker failed because Cloudflare is down |
|
@MikeMcQuaid Sorry for the spam — Cloudflare seems to have recovered. Could you add the PR again to the queue? |
|
@devnoname120 No apologies needed, appreciate the responsiveness! |
brew lgtm(style, typechecking and tests) with your changes locally?Summary
This PR adds support for the macOS-only
ThrottleIntervaloption 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
throttle_intervalmethod to Service classThrottleIntervalinto_plistmethod for macOS launchd plist generationthrottle_intervaltoto_hashandfrom_hashmethods for API serializationthrottle_intervalvalues (including zero)ThrottleIntervalappears in generated launchd plistMotivation
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 aThrottleIntervalvalue. This PR restores this macOS-only functionality.