New in Symfony 2.4: Limit a Process Run with an idle Timeout
Since the release of Symfony 2.3, the stability of the Process component has been greatly improved thanks to the hard work of Romain Neutron. But today, I want to talk about a new feature that can be quite useful when dealing with long running processes, the ability to define an idle timeout.
Up until now, you were able to limit the time a process take to finish by
setTimeout() method; this is a the maximum number of seconds a
process can take to finish its work:
$process->setTimeout(2 * 3600);
In Symfony 2.4, you can also define an idle timeout (via the
setIdleTimeout() method); this is the maximum number of seconds a process
can run without outputting anything (on the standard or the error output):
$process->setIdleTimeout(10 * 60);
When a timeout occurs, the Process throws a
Symfony\Component\Process\Exception\ProcessTimedOutException. You can
make the difference between the two kind of timeouts by calling the
isGeneralTimeout() or the
New in Symfony 2.4: Limit a Process Run with an idle Timeout symfony.com/blog/new-in-symfony-2-4-limit-a-process-run-with-an-idle-timeoutTweet this
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.