Skip to content
Snippets Groups Projects

Automated Project Update Bot fixes

1 file
+ 6
1
Compare changes
  • Side-by-side
  • Inline
@@ -61,12 +61,17 @@ function cloudfront_cache_path_invalidate_url(array $paths) {
// Load AWS SDK.
$cloudFront = new CloudFrontClient($args);
// Try to create unique caller_reference. This is to hopefully resolve the
// "Your request contains a caller reference that was used for a previous
// invalidation batch for the same distribution." error that we sometimes get.
$caller_reference = md5(implode(',', $paths)) . time();
// Invalidate URL.
try {
$cloudFront->createInvalidation([
'DistributionId' => Settings::get('aws.distributionid'),
'InvalidationBatch' => [
'CallerReference' => date('U') . \Drupal::currentUser()->getAccountName(),
'CallerReference' => $caller_reference,,
'Paths' => [
'Items' => $paths,
'Quantity' => $total_paths,
Loading