File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,11 @@ module.exports = function (RED) {
99
99
node . query = config . query ;
100
100
node . split = config . split ;
101
101
node . rowsPerMsg = config . rowsPerMsg ;
102
- node . config = RED . nodes . getNode ( config . postgreSQLConfig ) ;
102
+ node . config = RED . nodes . getNode ( config . postgreSQLConfig ) || {
103
+ pgPool : {
104
+ totalCount : 0 ,
105
+ } ,
106
+ } ;
103
107
104
108
// Declare the ability of this node to provide ticks upstream for back-pressure
105
109
node . tickProvider = true ;
@@ -128,7 +132,7 @@ module.exports = function (RED) {
128
132
let fill = 'grey' ;
129
133
if ( hasError ) {
130
134
fill = 'red' ;
131
- } else if ( nbQueue <= 0 || ! node . config . pgPool ) {
135
+ } else if ( nbQueue <= 0 ) {
132
136
fill = 'blue' ;
133
137
} else if ( nbQueue <= node . config . pgPool . totalCount ) {
134
138
fill = 'green' ;
@@ -137,7 +141,7 @@ module.exports = function (RED) {
137
141
}
138
142
node . status ( {
139
143
fill,
140
- shape : hasError || ! node . config . pgPool || nbQueue > node . config . pgPool . totalCount ? 'ring' : 'dot' ,
144
+ shape : hasError || nbQueue > node . config . pgPool . totalCount ? 'ring' : 'dot' ,
141
145
text : 'Queue: ' + nbQueue + ( hasError ? ' Error!' : '' ) ,
142
146
} ) ;
143
147
hasError = false ;
You can’t perform that action at this time.
0 commit comments