Skip to content

Commit

Permalink
Use 26 hour window
Browse files Browse the repository at this point in the history
  • Loading branch information
farski committed Oct 14, 2024
1 parent 403e845 commit 4c7d76c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/alarm-slack-report/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ export const handler = async (event) => {

const reports = [];

const hoursAgo24 = new Date();
hoursAgo24.setUTCHours(-24);
const hoursAgo26 = new Date();
hoursAgo26.setUTCHours(-26);

// eslint-disable-next-line no-restricted-syntax
for (const accountId of process.env.SEARCH_ACCOUNTS.split(",")) {
Expand All @@ -134,15 +134,15 @@ export const handler = async (event) => {
for (const alarm of data.MetricAlarms.filter(filterByName)) {
const ts = Date.parse(alarm.StateTransitionedTimestamp);

if (ts >= +hoursAgo24) {
if (ts >= +hoursAgo26) {
const paginator = paginateDescribeAlarmHistory(
{
client: cloudwatch,
},
{
AlarmName: alarm.alarmName,
HistoryItemType: "StateUpdate",
StartDate: hoursAgo24,
StartDate: hoursAgo26,
EndDate: new Date(),
},
);
Expand Down Expand Up @@ -182,7 +182,7 @@ export const handler = async (event) => {
type: "header",
text: {
type: "plain_text",
text: ":memo: 24-Hour Alarm Report",
text: ":memo: 26-Hour Alarm Report",
emoji: true,
},
});
Expand Down

0 comments on commit 4c7d76c

Please sign in to comment.