From 379d46a753393b8d89c5a5b466f3216e9d305156 Mon Sep 17 00:00:00 2001 From: Jim Gaylard Date: Wed, 30 Nov 2016 11:17:44 +1100 Subject: [PATCH] memoise s3_client Every time a new s3 client is initialised it makes a call to the metadata service. AWS rate limit this service and this can result in errors --- lib/blobby/s3_store.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/blobby/s3_store.rb b/lib/blobby/s3_store.rb index dcee156..5295acb 100644 --- a/lib/blobby/s3_store.rb +++ b/lib/blobby/s3_store.rb @@ -97,7 +97,7 @@ def force_binary(s) private def s3_client - ::Aws::S3::Client.new(s3_options) + @s3_client ||= ::Aws::S3::Client.new(s3_options) end def s3_endpoint_for_bucket