Skip to content

Commit

Permalink
fix(logs-cleanup): skip log groups that failed to delete
Browse files Browse the repository at this point in the history
  • Loading branch information
NimmLor committed Jan 4, 2023
1 parent e9d65e1 commit c8b186d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions API.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion src/index.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ const stopAllExecutions = async (stateMachineArn: string) => {
};

const deleteLogGroup = async (logGroupName: string) => {
return cwl.deleteLogGroup({ logGroupName }).promise();
return cwl
.deleteLogGroup({ logGroupName })
.promise()
.catch((error) => {
if (error.code !== "ResourceNotFoundException") {
console.warn("Failed to delete log group: " + logGroupName, { error });
}
});
};

export const handler = async (
Expand Down

0 comments on commit c8b186d

Please sign in to comment.