The destructor can be called on shutdown so any operation which
relies on another object or resource can fail. E.g. running
anything involving Redis (such as >>new Message('').''<<)
from shell.php and then exiting will result in a RedisException
since the PHP engine closes the Redis connection before destroying
the connection pool. Such errors can be safely ignored.
Change-Id: I38474a9dda89c82edbcb878facb4a97740e9189a
function __destruct() {
foreach ( $this->connections as $server => &$serverConnections ) {
foreach ( $serverConnections as $key => &$connection ) {
- /** @var Redis $conn */
- $conn = $connection['conn'];
- $conn->close();
+ try {
+ /** @var Redis $conn */
+ $conn = $connection['conn'];
+ $conn->close();
+ } catch ( RedisException $e ) {
+ // The destructor can be called on shutdown when random parts of the system
+ // have been destructed already, causing weird errors. Ignore them.
+ }
}
}
}