Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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.

share|improve this answer
    
But the issue is I don't think the files are being modified that often. –  asmeurer Jan 16 at 2:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.