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:
parent
7138e1473b
commit
e305cede8f
@ -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
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user