Skip to content

Commit

Permalink
Add resource name to log
Browse files Browse the repository at this point in the history
  • Loading branch information
dowied4 committed Nov 6, 2023
1 parent 2771c30 commit 957cb0a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion spec/push/cloudwatch/event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
)
end

it 'raises exception when retry limit exceeded' do
it 'retries method 3 times' do
subject.to_loggly!
expect(Aws::Lambda::Client).to have_received(:new).exactly(3).times
end
Expand Down
4 changes: 2 additions & 2 deletions spec/subscribe/lambda/function_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
)
end

it 'raises exception when retry limit exceeded' do
it 'retries method 3 times for each function' do
described_class.new(
arn: 'test',
name: 'test',
Expand Down Expand Up @@ -260,7 +260,7 @@
)
end

it 'raises exception when retry limit exceeded' do
it 'retries method 3 times for each function' do
described_class.subscribe_all!(lambda, cloudwatch)
expect(cloudwatch).to have_received(:describe_subscription_filters).exactly(6).times
end
Expand Down
8 changes: 4 additions & 4 deletions subscribe/lambda/function.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ def fetch_tags!
retries ||= 0
lambda.list_tags(resource: arn).tags
rescue Aws::Lambda::Errors::ThrottlingException => e
puts "ThrottlingExceptionFetchTags (retry attempt: #{retries}): #{e.inspect}"
puts "ThrottlingExceptionFetchTags (Resource: #{name}): #{e.inspect}"
retry if (retries += 1) < 3

puts 'ThrottlingExceptionFetchTagsRetryLimitExceeded'
puts "ThrottlingExceptionFetchTagsRetryLimitExceeded (Resource: #{name})"

[]
end
Expand All @@ -126,10 +126,10 @@ def subscriptions
).subscription_filters
end
rescue Aws::CloudWatchLogs::Errors::ThrottlingException => e
puts "ThrottlingExceptionSubscriptions (retry attempt: #{retries}): #{e.inspect}"
puts "ThrottlingExceptionSubscriptions (Resource: #{name}): #{e.inspect}"
retry if (retries += 1) < 3

puts 'ThrottlingExceptionSubscriptionsRetryLimitExceeded'
puts "ThrottlingExceptionSubscriptionsRetryLimitExceeded (Resource: #{name})"
[]
end

Expand Down

0 comments on commit 957cb0a

Please sign in to comment.