File tree Expand file tree Collapse file tree 2 files changed +14
-16
lines changed Expand file tree Collapse file tree 2 files changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -96,23 +96,19 @@ new client.Gauge({
96
96
labelNames : [ 'status' ] ,
97
97
async collect ( ) {
98
98
const statusResults = await db . queryAsync ( `
99
- SELECT
100
- SUM(CASE WHEN verified > 0 THEN 1 ELSE 0 END) AS verified,
101
- SUM(CASE WHEN flagged > 0 THEN 1 ELSE 0 END) AS flagged,
102
- SUM(CASE WHEN hibernated > 0 THEN 1 ELSE 0 END) AS hibernated,
103
- SUM(CASE WHEN turbo_expiration > UNIX_TIMESTAMP() THEN 1 ELSE 0 END) AS active_turbo,
104
- SUM(CASE WHEN turbo_expiration > 0 AND turbo_expiration <= UNIX_TIMESTAMP() THEN 1 ELSE 0 END) AS expired_turbo
105
- FROM spaces
99
+ SELECT 'verified' as status, COUNT(*) as count FROM spaces WHERE verified > 0
100
+ UNION ALL
101
+ SELECT 'flagged' as status, COUNT(*) as count FROM spaces WHERE flagged > 0
102
+ UNION ALL
103
+ SELECT 'hibernated' as status, COUNT(*) as count FROM spaces WHERE hibernated > 0
104
+ UNION ALL
105
+ SELECT 'active_turbo' as status, COUNT(*) as count FROM spaces WHERE turbo_expiration > UNIX_TIMESTAMP()
106
+ UNION ALL
107
+ SELECT 'expired_turbo' as status, COUNT(*) as count FROM spaces WHERE turbo_expiration > 0 AND turbo_expiration <= UNIX_TIMESTAMP()
106
108
` ) ;
107
109
108
- [
109
- 'verified' ,
110
- 'flagged' ,
111
- 'hibernated' ,
112
- 'active_turbo' ,
113
- 'expired_turbo'
114
- ] . forEach ( status => {
115
- this . set ( { status } , statusResults [ 0 ] [ status ] ) ;
110
+ statusResults . forEach ( ( row : any ) => {
111
+ this . set ( { status : row . status } , row . count ) ;
116
112
} ) ;
117
113
}
118
114
} ) ;
Original file line number Diff line number Diff line change @@ -34,7 +34,9 @@ sequencerConfig.connectTimeout = 60e3;
34
34
sequencerConfig . acquireTimeout = 60e3 ;
35
35
sequencerConfig . timeout = 60e3 ;
36
36
sequencerConfig . charset = 'utf8mb4' ;
37
- sequencerConfig . ssl = { rejectUnauthorized : sequencerConfig . host !== 'localhost' } ;
37
+ sequencerConfig . ssl = {
38
+ rejectUnauthorized : sequencerConfig . host !== 'localhost'
39
+ } ;
38
40
39
41
const sequencerDB = mysql . createPool ( sequencerConfig ) ;
40
42
You can’t perform that action at this time.
0 commit comments