From eb7b7fa14522e1a53192171d3f8e5550a8f97270 Mon Sep 17 00:00:00 2001 From: Joe Dixon Date: Tue, 19 Dec 2023 08:32:57 +0000 Subject: [PATCH] update dependencies (#163) --- composer.json | 3 +-- src/Runtime/Handlers/WarmerHandler.php | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 5271228..92d18c7 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,7 @@ "require": { "php": "^7.2|^8.0", "aws/aws-sdk-php": "^3.80", - "psr/http-message": "^1.0", - "guzzlehttp/promises": "^1.4.0", + "guzzlehttp/promises": "^1.4|^2.0", "guzzlehttp/guzzle": "^6.3|^7.0", "hollodotme/fast-cgi-client": "^3.0", "illuminate/container": "^6.0|^7.0|^8.0|^9.0|^10.0", diff --git a/src/Runtime/Handlers/WarmerHandler.php b/src/Runtime/Handlers/WarmerHandler.php index b0784c8..64e0c1c 100644 --- a/src/Runtime/Handlers/WarmerHandler.php +++ b/src/Runtime/Handlers/WarmerHandler.php @@ -3,7 +3,7 @@ namespace Laravel\Vapor\Runtime\Handlers; use Aws\Lambda\LambdaClient; -use GuzzleHttp\Promise; +use GuzzleHttp\Promise\Utils; use Laravel\Vapor\Contracts\LambdaEventHandler; use Laravel\Vapor\Runtime\ArrayLambdaResponse; use Laravel\Vapor\Runtime\Logger; @@ -14,7 +14,6 @@ class WarmerHandler implements LambdaEventHandler /** * Handle an incoming Lambda event. * - * @param array $event * @return \Laravel\Vapor\Contracts\LambdaResponse */ public function handle(array $event) @@ -22,7 +21,7 @@ public function handle(array $event) try { Logger::info('Executing warming requests...'); - Promise\settle( + Utils::settle( $this->buildPromises($this->lambdaClient(), $event) )->wait(); } catch (Throwable $e) { @@ -37,21 +36,19 @@ public function handle(array $event) /** * Build the array of warmer invocation promises. * - * @param \Aws\Lambda\LambdaClient $lambda - * @param array $event * @return array */ protected function buildPromises(LambdaClient $lambda, array $event) { return collect(range(1, $event['concurrency'] - 1)) - ->mapWithKeys(function ($i) use ($lambda, $event) { - return ['warmer-'.$i => $lambda->invokeAsync([ - 'FunctionName' => $event['functionName'], - 'Qualifier' => $event['functionAlias'], - 'LogType' => 'None', - 'Payload' => json_encode(['vaporWarmerPing' => true]), - ])]; - })->all(); + ->mapWithKeys(function ($i) use ($lambda, $event) { + return ['warmer-'.$i => $lambda->invokeAsync([ + 'FunctionName' => $event['functionName'], + 'Qualifier' => $event['functionAlias'], + 'LogType' => 'None', + 'Payload' => json_encode(['vaporWarmerPing' => true]), + ])]; + })->all(); } /**