diff --git a/runtime/lib/Propel.php b/runtime/lib/Propel.php index e5061f2b8..deac8b765 100644 --- a/runtime/lib/Propel.php +++ b/runtime/lib/Propel.php @@ -683,7 +683,7 @@ public static function initConnection($conparams, $name, $defaultClass = Propel: } try { - $con = new $classname(self::resolveCachedDsnHost($dsn), $user, $password, $driver_options); + $con = new $classname($dsn, $user, $password, $driver_options); $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $con->setAttribute(PropelPDO::PROPEL_ATTR_CONNECTION_NAME, $name); @@ -944,33 +944,6 @@ public static function isInstancePoolingEnabled() { return self::$instancePoolingEnabled; } - - /** - * Within Lambda we are unable to easily cache DNS records as we do on conventional servers. - * As each request creates a new connection, the amount of DNS queries we perform can mount up. - * This adds an application-level cache for storing the resolved IP of the desired host (env: CACHE_PDO_HOST_DNS). - */ - private static function resolveCachedDsnHost(string $dsn, int $ttlInSeconds = 300): string - { - $hostname = \getenv('PROPEL_CACHE_PDO_HOST_DNS'); - - if (!$hostname || false === \strpos($dsn, $hostname)) { - return $dsn; - } - - if (false === \function_exists('apcu_entry')) { - return $dsn; - } - - $ip = \apcu_entry($hostname, function (string $name): string { - if (\class_exists('\MyBuilder\Bundle\LogBundle\Metrics')) { - \MyBuilder\Bundle\LogBundle\Metrics::increment('pdo.dns-cache.miss', ['host' => $name]); - } - return \gethostbyname($name); - }, $ttlInSeconds); - - return \str_replace($hostname, $ip, $dsn); - } } // Since the Propel class is not a true singleton, this code cannot go into the __construct()