diff --git a/src/Config/Configuration.php b/src/Config/Configuration.php index 235b5fad..25606dbe 100644 --- a/src/Config/Configuration.php +++ b/src/Config/Configuration.php @@ -15,6 +15,7 @@ class Configuration implements IConfiguration private ?ILoggerFactory $loggerFactory; private ?ITransportStrategy $transportStrategy; + protected static int $maxIdleMillis = 4 * 60 * 1000; public function __construct(?ILoggerFactory $loggerFactory, ?ITransportStrategy $transportStrategy) { diff --git a/src/Config/Configurations/InRegion.php b/src/Config/Configurations/InRegion.php index ab47d9ac..46e76ab7 100644 --- a/src/Config/Configurations/InRegion.php +++ b/src/Config/Configurations/InRegion.php @@ -9,15 +9,12 @@ use Momento\Logging\ILoggerFactory; use Momento\Logging\NullLoggerFactory; -const MAX_IDLE_MILLIS = 4 * 60 * 1000; - /** * InRegion provides defaults suitable for an environment where your client is running in the same region as the Momento * service. It has more aggressive timeouts and retry behavior than the Laptop config. */ class InRegion extends Configuration { - /** * Provides the latest recommended configuration for an InRegion environment. * This configuration may change in future releases to take advantage of @@ -42,8 +39,7 @@ public static function v1(?ILoggerFactory $loggerFactory = null): Laptop { $loggerFactory = $loggerFactory ?? new NullLoggerFactory(); $grpcConfig = new StaticGrpcConfiguration(1100); - $transportStrategy = new StaticTransportStrategy(null, $grpcConfig, $loggerFactory, MAX_IDLE_MILLIS); + $transportStrategy = new StaticTransportStrategy(null, $grpcConfig, $loggerFactory, self::$maxIdleMillis); return new Laptop($loggerFactory, $transportStrategy); } - } diff --git a/src/Config/Configurations/Laptop.php b/src/Config/Configurations/Laptop.php index 81a07174..c1402e53 100644 --- a/src/Config/Configurations/Laptop.php +++ b/src/Config/Configurations/Laptop.php @@ -9,15 +9,12 @@ use Momento\Logging\ILoggerFactory; use Momento\Logging\NullLoggerFactory; -const MAX_IDLE_MILLIS = 4 * 60 * 1000; - /** * Laptop config provides defaults suitable for a medium-to-high-latency dev environment. Permissive timeouts, retries, and * relaxed latency and throughput targets. */ class Laptop extends Configuration { - /** * Provides the latest recommended configuration for a Laptop environment. * @@ -40,8 +37,7 @@ public static function v1(?ILoggerFactory $loggerFactory = null): Laptop { $loggerFactory = $loggerFactory ?? new NullLoggerFactory(); $grpcConfig = new StaticGrpcConfiguration(5000); - $transportStrategy = new StaticTransportStrategy(null, $grpcConfig, $loggerFactory, MAX_IDLE_MILLIS); + $transportStrategy = new StaticTransportStrategy(null, $grpcConfig, $loggerFactory, self::$maxIdleMillis); return new Laptop($loggerFactory, $transportStrategy); } - }