1

I have a launchd agent set up using the WatchPaths feature. It looks something like

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.my.label</string>
    <key>LowPriorityIO</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/bash</string>
        <string>-c</string>
        <string>PROGRAM HERE</string>
    </array>
    <key>QueueDirectories</key>
    <array/>
    <key>ThrottleInterval</key>
    <integer>10</integer>
    <key>WatchPaths</key>
    <array>
        <string>PATH HERE</string>
    </array>
</dict>
</plist>

Every 10 seconds, I get a message to the console, like

com.apple.launchd.peruser.501: (com.my.label) Throttling respawn: Will start in 10 seconds

Is this normal? Will it affect my system to have these messages written to the logs every 10 seconds? There are no errors, and the agent itself seems to work just fine.

2
  • Is your QueueDirectories setting truly blank? If you are using any, make sure they are empty by the time your process ends.
    – natevw
    Commented Apr 5, 2018 at 19:06
  • No I don't have any queue directories. I am using watch paths. Should the empty key be removed? I think I created this originally using Lingon.
    – asmeurer
    Commented Apr 6, 2018 at 19:12

1 Answer 1

0

launchd will only start the program at most every 10 seconds. From man launchd.plist:

ThrottleInterval <integer>
This key lets one override the default throttling policy imposed on jobs
by launchd.  The value is in seconds, and by default, jobs will not be
spawned more than once every 10 seconds.  The principle behind this is
that jobs should linger around just in case they are needed again in the
near future. This not only reduces the latency of responses, but it
encourages developers to amortize the cost of program invocation.

If a file in WatchPaths is modified within 10 seconds from the last invocation, it's normal that the job gets throttled. Setting ThrottleInterval to a value below 10 has no effect.

If you want to remove those log messages, add something like sleep 10 to the end of the program.

1
  • But the issue is I don't think the files are being modified that often.
    – asmeurer
    Commented Jan 16, 2014 at 2:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .