Skip to content

Commit

Permalink
update dependencies (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
joedixon authored Dec 19, 2023
1 parent 939e88e commit eb7b7fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
23 changes: 10 additions & 13 deletions src/Runtime/Handlers/WarmerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -14,15 +14,14 @@ class WarmerHandler implements LambdaEventHandler
/**
* Handle an incoming Lambda event.
*
* @param array $event
* @return \Laravel\Vapor\Contracts\LambdaResponse
*/
public function handle(array $event)
{
try {
Logger::info('Executing warming requests...');

Promise\settle(
Utils::settle(
$this->buildPromises($this->lambdaClient(), $event)
)->wait();
} catch (Throwable $e) {
Expand All @@ -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();
}

/**
Expand Down

0 comments on commit eb7b7fa

Please sign in to comment.