1
0
mirror of https://github.com/tormachris/cf-workers-status-page.git synced 2024-11-23 22:45:43 +01:00

fix(gc): wait for gc to complete before exiting cron trigger

This commit is contained in:
Adam Janis 2020-11-14 02:37:42 +01:00
parent 7138e1473b
commit e305cede8f
3 changed files with 3 additions and 6 deletions

View File

@ -24,8 +24,6 @@ export async function getEdgeProps() {
if (x.metadata.operational === false) monitorsOperational = false
})
console.log(JSON.stringify(kvMonitorsMap))
// transform KV list to array of failed days
const kvMonitorsFailedDaysArray = kvMonitorsFailedDays.map(x => {
return x.name

View File

@ -53,7 +53,6 @@ export async function processCronTrigger(event) {
if (!newMetadata.operational) {
// try to get failed daily status first as KV read is cheaper than write
const kvFailedDayStatusKey = 'h_' + monitor.id + '_' + getDate()
console.log(kvFailedDayStatusKey)
const kvFailedDayStatus = await getKV(kvFailedDayStatusKey)
// write if not found

View File

@ -69,10 +69,10 @@ export async function gcMonitors(config) {
const keysForRemoval = kvState.filter(x => !monitors.includes(x))
keysForRemoval.forEach(key => {
for (const key of keysForRemoval) {
console.log('gc: deleting ' + checkKvPrefix + key)
deleteKV(checkKvPrefix + key)
})
await deleteKV(checkKvPrefix + key)
}
}
export async function notifySlack(monitor, newMetadata) {