Metered networks
On an iPhone’s Personal Hotspot, App Auto-Patch’s downloads come out of someone’s mobile data plan. One patch cycle can download several gigabytes of installers, and an install can start while the Mac is on a slow, costly link. MeteredNetworkPolicy holds the work App Auto-Patch starts by itself while the Mac is on a metered network. MeteredNetworkMaxDays makes sure a Mac that is always on one still gets patched. Both keys are new in 4.0.0 (132) and are read from a profile only.
What counts as metered
Section titled “What counts as metered”App Auto-Patch asks macOS about the network the Mac is using now (NWPathMonitor). A network is metered when macOS marks it as expensive, as it does for an iPhone or iPad Personal Hotspot and for cellular, or when Low Data Mode is on for it. A Personal Hotspot is usually both. If macOS can’t tell, the network isn’t treated as metered and App Auto-Patch behaves as it always has. The app and the root helper each watch the network, and the log says when it changes:
MeteredNetworkMonitor: The network is now expensive (Personal Hotspot or cellular), Low Data Mode, over Wi-Fi.The policies
Section titled “The policies”Ignore (default) |
Warn |
Defer |
|
|---|---|---|---|
| Staging (pre-downloading installers) | runs | waits | waits |
| Background pass for closed apps, app or helper | runs | waits | waits |
Installer reads (VersionComparisonInstallomatorFallback) |
run | wait | wait |
| Deferral dialog for open apps | opens | opens, with a red line | held, 5 minutes at a time |
Dialog timeout with DialogTimeoutDeferralAction = continue |
installs | defers | defers |
| Installs the user starts | run | run | run |
| App Auto-Patch’s own update | runs | runs | runs |
With Warn and Defer, the deferral dialog shows a red line under its title: This Mac is on a metered connection, such as a Personal Hotspot. Updating now uses its data. It shows whenever the dialog opens on a metered network, deadline prompts included.
Warnleaves the user to decide. Nothing downloads in the background, but the dialog still opens, so the user can install now or defer. A dialog nobody answers defers, even whenDialogTimeoutDeferralActioniscontinue, since nobody chose to spend the data. A deferral counts as usual.Deferalso keeps the dialog from opening by itself. Like the deferral for a user who is away, it is put off 5 minutes at a time without counting a deferral, and it opens within 5 minutes of the Mac leaving the metered network.- What the user starts always runs: Update All, a row’s update button, Update Selected, Install Now, and the menu bar’s Update All. Clicking one is the user’s choice to spend the data. It downloads only the apps it installs; the other pending updates aren’t staged beside it. Checking for updates also still runs: it downloads little.
App Auto-Patch’s own update
Section titled “App Auto-Patch’s own update”A hold never keeps App Auto-Patch from updating itself:
- With
SelfUpdateMethodBackgroundSchedule, the schedule’s checks and installs run on any network. - With
InAppList(the default) andWarn, App Auto-Patch is in the deferral dialog with the other apps, as usual. - With
InAppListandDefer, the dialog is held, so App Auto-Patch installs its own pending update by itself, asBackgroundSchedulewould. The other apps wait.
With nobody logged in, the root helper’s background pass is held as a whole, and App Auto-Patch’s own update waits with it.
When a hold ends
Section titled “When a hold ends”A hold ends when the Mac moves to a network that isn’t metered. It also ends, even on a metered network, in these cases:
- The hard deadline. At
DeadlineDaysHardorDeadlineCountHard, App Auto-Patch patches as on any other network, and the hard-deadline pass of the root helper isn’t held either. MeteredNetworkMaxDays(default 7). The days count from the first hold since patching last completed. After that many days, App Auto-Patch ignores the metered state until patching completes, then starts counting again at the next hold. This is the backstop for Macs that rely on a count deadline, which never arrives whileDeferkeeps the dialog closed, or that have no deadline at all. Set it to0for no limit. WhenDeadlineDaysHardcomes first, it ends the hold sooner, so aMeteredNetworkMaxDayslarger thanDeadlineDaysHardhas no effect.
The log says when either one ends a hold:
StatusViewModel: The network is metered, but MeteredNetworkMaxDays (7) has passed since the first hold, so App Auto-Patch patches as on any other network until patching completes.Example
Section titled “Example”Hold background downloads on a hotspot, let users decide in the dialog, and patch anyway after five days:
<key>MeteredNetworkPolicy</key><string>Warn</string><key>MeteredNetworkMaxDays</key><integer>5</integer>Reading the log
Section titled “Reading the log”A held pass or dialog says why, once per change:
BackgroundPatchScheduler: Tick skipped — the network is expensive (Personal Hotspot or cellular), Low Data Mode, over Wi-Fi and MeteredNetworkPolicy is Warn.HelperBackgroundPatchScheduler: Holding the background pass because the network is expensive (Personal Hotspot or cellular), Low Data Mode, over Wi-Fi and MeteredNetworkPolicy is Defer.StatusViewModel: Holding the deferral dialog because the network is … and MeteredNetworkPolicy is Defer. Trying again every 5 minutes, without counting a deferral, until the network isn't metered, the hard deadline or MeteredNetworkMaxDays.