Skip to content
This repository was archived by the owner on Jul 2, 2023. It is now read-only.

Commit 649a2ba

Browse files
committed
Caller should be randomized each time
1 parent feba4d5 commit 649a2ba

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/CloudFrontInvalidations.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
use Aws\CloudFront\CloudFrontClient;
66
use Kirby\Cms\Page;
7-
use Kirby\Http\Remote;
87
use Kirby\Toolkit\Collection;
8+
use Kirby\Toolkit\Str;
99

1010
class CloudFrontInvalidations
1111
{
@@ -78,14 +78,12 @@ public static function purgeURLs($pagesOrURLs)
7878
]
7979
]);
8080

81-
$caller = $_ENV['HTTP_HOST'];
82-
8381
foreach (array_chunk($pagesOrURLs, static::API_URL_BATCH_SIZE) as $urlBatch) {
8482
$items = array_values($urlBatch);
8583
$invalidation = [
8684
'DistributionId' => $cloudFrontDistributionId,
8785
'InvalidationBatch' => [
88-
'CallerReference' => $caller,
86+
'CallerReference' => Str::random(16),
8987
'Paths' => [
9088
'Items' => $items,
9189
'Quantity' => count($items)
@@ -95,5 +93,4 @@ public static function purgeURLs($pagesOrURLs)
9593
$cloudFront->createInvalidation($invalidation);
9694
}
9795
}
98-
9996
}

0 commit comments

Comments
 (0)