Skip to content

Commit

Permalink
🐛 fix: notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
yunsii committed Mar 15, 2024
1 parent 97e5102 commit 75ba372
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Config } from './types'
export const config: Config = {
settings: {
title: 'Status Page',
url: 'https://status-page.eidam.dev',
url: 'https://cf-worker-status-page-pro-production.yunsii.workers.dev',
daysInHistogram: 90,
collectResponseTimes: true,
},
Expand Down
8 changes: 4 additions & 4 deletions src/worker/_helpers/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export async function notifySlack(monitor: Monitor, operational: boolean, option
},
],
}
return fetch(webhook, {
return await fetch(webhook, {
body: JSON.stringify(payload),
method: 'POST',
headers: { 'Content-Type': 'application/json' },
Expand Down Expand Up @@ -84,7 +84,7 @@ export async function notifyTelegram(monitor: Monitor, operational: boolean, opt
payload.append('text', text)

const telegramUrl = `https://api.telegram.org/bot${apiToken}/sendMessage`
return fetch(telegramUrl, {
return await fetch(telegramUrl, {
body: payload,
method: 'POST',
})
Expand Down Expand Up @@ -115,7 +115,7 @@ export async function notifyDiscord(monitor: Monitor, operational: boolean, opti
},
],
}
return fetch(webhook, {
return await fetch(webhook, {
body: JSON.stringify(payload),
method: 'POST',
headers: { 'Content-Type': 'application/json' },
Expand Down Expand Up @@ -160,5 +160,5 @@ export function getNotifications(monitor: Monitor, monitorOperational: boolean,
})
afterFetch?.()
},
]
].map((item) => item())
}
1 change: 0 additions & 1 deletion src/worker/cron/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export async function handleCronTrigger(event: FetchEvent) {
})

if (monitorStatusChanged) {
console.log('monitorStatusChanged to', monitorOperational)
event.waitUntil(Promise.allSettled(notifications))
}

Expand Down

0 comments on commit 75ba372

Please sign in to comment.