Skip to content

Commit 32a5260

Browse files
author
Vinicius Barros
committed
fix: formatting
1 parent 492a1ec commit 32a5260

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

packages/cloudwatch-logs-auto-subscribe/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ For more details, read this [post](https://theburningmonk.com/2019/05/how-to-inc
5959

6060
`SleepBetweenMaxQuotaRequests`: (optional) Amount of time in milliseconds to sleep after making {AwsMaxRequestsPerSecQuota} consecutive requests. It might be useful if an AWS account has a large amount of LogGroups or if experiencing Rate Exceeded throttling frequently. Suggested to use a value equal or bellow 1000, as quotas are per second. Defaults to 0.
6161

62-
`AwsMaxRequestsPerSecQuota`: (optional) AWS quota for the max number of requests per second on DescribeLogGroups. This parameter is only used when SleepBetweenMaxQuotaRequests is greater than 0. More info: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/cloudwatch_limits_cwl.html. Defaults to 5
62+
`AwsMaxRequestsPerSecQuota`: (optional) AWS quota for the max number of requests per second on DescribeLogGroups. This parameter is only used when SleepBetweenMaxQuotaRequests is greater than 0. More info: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/cloudwatch_limits_cwl.html. Defaults to 5.

packages/cloudwatch-logs-auto-subscribe/functions/subscribe.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ const lambda = require("./lib/lambda");
22
const cloudWatchLogs = require("./lib/cloudwatch-logs");
33
const log = require("@dazn/lambda-powertools-logger");
44

5-
const { FILTER_NAME, DESTINATION_ARN} = process.env;
6-
const SLEEP_BETWEEN_MAX_QUOTA_REQUESTS = parseInt(process.env.SLEEP_BETWEEN_MAX_QUOTA_REQUESTS);
7-
const AWS_MAX_REQUESTS_PER_SEC_QUOTA = parseInt(process.env.AWS_MAX_REQUESTS_PER_SEC_QUOTA);
5+
const { FILTER_NAME, DESTINATION_ARN } = process.env;
6+
const SLEEP_BETWEEN_MAX_QUOTA_REQUESTS = parseInt(process.env.SLEEP_BETWEEN_MAX_QUOTA_REQUESTS, 10);
7+
const AWS_MAX_REQUESTS_PER_SEC_QUOTA = parseInt(process.env.AWS_MAX_REQUESTS_PER_SEC_QUOTA, 10);
88

9-
function sleep(milliseconds){
9+
function sleep(milliseconds) {
1010
return new Promise(r => setTimeout(r, milliseconds));
1111
}
1212

@@ -21,7 +21,7 @@ module.exports.existingLogGroups = async () => {
2121
} catch(error) {
2222
log.warn("cannot process existing log group, skipped...", { logGroupName }, error);
2323
}
24-
if (SLEEP_BETWEEN_MAX_QUOTA_REQUESTS > 0 && (log_group_index+1) % AWS_MAX_REQUESTS_PER_SEC_QUOTA == 0) {
24+
if (SLEEP_BETWEEN_MAX_QUOTA_REQUESTS && ((log_group_index + 1) % AWS_MAX_REQUESTS_PER_SEC_QUOTA == 0)) {
2525
await sleep(SLEEP_BETWEEN_MAX_QUOTA_REQUESTS);
2626
}
2727
}

packages/cloudwatch-logs-auto-subscribe/template.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,6 @@ Parameters:
284284
Type: Number
285285
Default: 5
286286
Description: >
287-
(optional) AWS quota for the max number of requests per second on DescribeLogGroups. This parameter is only used
288-
when SleepBetweenMaxQuotaRequests is greater than 0. More info:
289-
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/cloudwatch_limits_cwl.html".
287+
(optional) AWS quota for the max number of requests per second on DescribeLogGroups.
288+
This parameter is only used when SleepBetweenMaxQuotaRequests is greater than 0.
289+
More info: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/cloudwatch_limits_cwl.html. Defaults to 5".

0 commit comments

Comments
 (0)