Openstatus www.openstatus.dev

update response (#1212)

authored by

Thibault Le Ouay and committed by
GitHub
46aaded7 3859b992

+8 -8
+8 -8
apps/workflows/src/checker/index.ts
··· 84 84 .where( 85 85 and( 86 86 eq(schema.monitorStatusTable.monitorId, monitor.id), 87 - eq(schema.monitorStatusTable.status, status), 88 - ), 87 + eq(schema.monitorStatusTable.status, status) 88 + ) 89 89 ) 90 90 .get(); 91 91 92 92 if (!affectedRegion?.count) { 93 - return; 93 + return c.json({ success: true }, 200); 94 94 } 95 95 96 96 if (affectedRegion.count >= numberOfRegions / 2 || numberOfRegions === 1) { ··· 103 103 and( 104 104 eq(incidentTable.monitorId, Number(monitorId)), 105 105 isNull(incidentTable.resolvedAt), 106 - isNull(incidentTable.acknowledgedAt), 107 - ), 106 + isNull(incidentTable.acknowledgedAt) 107 + ) 108 108 ) 109 109 .get(); 110 110 111 111 if (!incident) { 112 112 // it was just a single failure not a proper incident 113 - return; 113 + break; 114 114 } 115 115 if (incident?.resolvedAt) { 116 116 // incident is already resolved 117 - return; 117 + break; 118 118 } 119 119 120 120 console.log(`🤓 recovering incident ${incident.id}`); ··· 153 153 case "degraded": 154 154 if (monitor.status !== "degraded") { 155 155 console.log( 156 - `🔄 update monitorStatus ${monitor.id} status: DEGRADED}`, 156 + `🔄 update monitorStatus ${monitor.id} status: DEGRADED}` 157 157 ); 158 158 await db 159 159 .update(schema.monitor)