mirror of
				https://github.com/tormachris/cf-workers-status-page.git
				synced 2025-11-04 04:46:24 +01:00 
			
		
		
		
	fix(gc): wait for gc to complete before exiting cron trigger
This commit is contained in:
		@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user