Version 4 of Pheanstalk is a partial rework of the most popular PHP library for Beanstalkd.
This release removes support for persistent connections and removes functions with side effects like putInTube
.
To be more flexible in deployment Pheanstalk now supports different socket implementations, if possible it will default to using the sockets
extension. Advantage of this extension is that it allows us to enable tcp KEEP ALIVE.
In Pheanstalk one common issue that people ran into was an undetectable connection failure. The consumer would wait infinitely but no new jobs would come in. For a lot of reasons it can be impossible for PHP (or even the underlying OS) to detect that a connection was dropped.
For this reason we recommend always:
- Use reserve with a timeout set to the maximum time you want a dropped connection to go unnoticed.
- Catch exceptions and re-instantiate Pheanstalk when needed.
Please test your code thoroughly before deploying version 4 in production. Specifically make sure your code handles exceptions and takes appropriate actions.