Skip to content

Commit

Permalink
Prevent AWS credentials refresh from stopping on exception
Browse files Browse the repository at this point in the history
If `aws_credentials()` fails due to an unstable network or other issues,
it throws an exception. This stops `timer_execute()` from repeating its block,
preventing `OpenSearchOutput` from updating `@_aws_credentials`.
As a result, `@_aws_credentials` will expire.

This commit catches the exception and prevents it from propagating to
`timer_execute()`, ensuring continuous credential updates.

Signed-off-by: Yuki Sekiguchi <[email protected]>
  • Loading branch information
aYukiSekiguchi committed Sep 6, 2024
1 parent c840b29 commit a8e1639
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/fluent/plugin/out_opensearch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,11 @@ class << self

@credential_mutex.synchronize do
@_os = nil
@_aws_credentials = aws_credentials(@endpoint)
begin
@_aws_credentials = aws_credentials(@endpoint)
rescue => e
log.error("Failed to get new AWS credentials: #{e}")
end
end
end
end
Expand Down

0 comments on commit a8e1639

Please sign in to comment.