Skip to content

Commit

Permalink
Merge pull request #830 from humanmade/backport-829-to-v16-branch
Browse files Browse the repository at this point in the history
[Backport v16-branch] Fix cavalcade runner memory usage leak
  • Loading branch information
joehoyle authored Nov 20, 2023
2 parents 8b386c2 + 3c27dea commit 44acd64
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions inc/cavalcade_runner_to_cloudwatch/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,17 @@ function ( $name, $value ) {
* @return CloudWatchClient
*/
function cloudwatch_client() : CloudWatchClient {
return Altis\get_aws_sdk()->createCloudWatch( [
'version' => '2010-08-01',
'http' => [
'synchronous' => false,
],
] );
static $client;
if ( ! $client ) {
$client = Altis\get_aws_sdk()->createCloudWatch( [
'version' => '2010-08-01',
'http' => [
'synchronous' => false,
],
] );
}

return $client;
}

/**
Expand All @@ -172,12 +177,16 @@ function cloudwatch_client() : CloudWatchClient {
* @return CloudWatchLogsClient
*/
function cloudwatch_logs_client() : CloudWatchLogsClient {
return Altis\get_aws_sdk()->createCloudWatchLogs( [
'version' => '2014-03-28',
'http' => [
'synchronous' => true,
],
] );
static $client;
if ( ! $client ) {
$client = Altis\get_aws_sdk()->createCloudWatchLogs( [
'version' => '2014-03-28',
'http' => [
'synchronous' => true,
],
] );
}
return $client;
}

/**
Expand Down

0 comments on commit 44acd64

Please sign in to comment.