@@ -33,7 +33,8 @@ const SKUNKWORKS_CHANNEL = '720952130562687016';
33
33
const networkABI = require ( './abis/IColonyNetwork.json' ) ;
34
34
const miningABI = require ( './abis/IReputationMiningCycle.json' ) ;
35
35
36
- let ongoingIncident = false ;
36
+ let ongoingGenericIncident = false ;
37
+ let ongoingGraphIncident = false ;
37
38
38
39
module . exports = robot => {
39
40
const { brain, messageChannel } = robot
@@ -50,7 +51,7 @@ module.exports = robot => {
50
51
}
51
52
52
53
async function getMessage ( ) {
53
- message = ""
54
+ let message = ""
54
55
// Get latest block from graph
55
56
const graphNumberRes = getGraphLatestBlock ( "https://xdai.colony.io/graph/subgraphs/name/joinColony/subgraph" )
56
57
// Get latest block from blockscout
@@ -126,7 +127,7 @@ module.exports = robot => {
126
127
127
128
message += `${ status ( smallestGraphDiscrepancy , 24 , 48 ) } Our graph latest block: ${ graphNumber } \n`
128
129
129
- if ( ( blockscoutLatestBlock - graphNumber ) >= 48 && ! ongoingIncident ) {
130
+ if ( ( blockscoutLatestBlock - graphNumber ) >= 48 && ! ongoingGraphIncident ) {
130
131
try { // Try and restart the graph digest pod
131
132
// By the time this happens, the deployments script should have authed us
132
133
// Get production colour
@@ -170,18 +171,24 @@ module.exports = robot => {
170
171
const message = await getMessage ( ) ;
171
172
channel . send ( message )
172
173
if ( message . indexOf ( "🔴" ) == - 1 ) {
173
- ongoingIncident = false ;
174
+ ongoingGenericIncident = false ;
175
+ ongoingGraphIncident = false ;
174
176
}
175
177
} )
176
178
177
179
async function checkStatus ( ) {
178
180
const message = await getMessage ( ) ;
179
- if ( message . indexOf ( "🔴" ) != - 1 && ! ongoingIncident ) {
180
- ongoingIncident = true ;
181
- channel . send ( "There appears to be an incident. \n" + message )
181
+ if ( message . indexOf ( "🔴 Our graph latest block" ) != - 1 && ! ongoingGraphIncident ) {
182
+ ongoingGraphIncident = true ;
183
+ channel . send ( "There appears to be an incident with the graph. \n" + message )
184
+ } else if ( message . indexOf ( "🔴" ) != - 1 && ! ongoingGenericIncident ) {
185
+ ongoingGenericIncident = true ;
186
+ channel . send ( "There appears to be a generic incident. \n" + message )
182
187
}
183
- if ( message . indexOf ( "🔴" ) == - 1 && ongoingIncident ) {
184
- ongoingIncident = false ;
188
+
189
+ if ( message . indexOf ( "🔴" ) == - 1 && ( ongoingGenericIncident || ongoingGraphIncident ) ) {
190
+ ongoingGenericIncident = false ;
191
+ ongoingGraphIncident = false ;
185
192
channel . send ( "Incident appears resolved.\n" + message )
186
193
}
187
194
}
0 commit comments