File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ function Connection(options = {}) {
24
24
let timer
25
25
let statement_id = 1
26
26
let ended
27
+ let open = false
27
28
let ready = false
28
29
let statements = { }
29
30
@@ -94,11 +95,11 @@ function Connection(options = {}) {
94
95
? prepared ( statements [ sig ] , args , query )
95
96
: prepare ( sig , str , args , query )
96
97
97
- backend . query || ! ready
98
- ? queries . push ( query )
99
- : ( backend . query = query )
100
-
101
98
ready
99
+ ? ( backend . query = query , ready = false )
100
+ : queries . push ( query )
101
+
102
+ open
102
103
? socket . write ( buffer )
103
104
: ( messages . push ( buffer ) , socket . connect ( ) )
104
105
}
@@ -137,13 +138,14 @@ function Connection(options = {}) {
137
138
if ( queries . length === 0 && ended )
138
139
return ended ( )
139
140
140
- if ( ! ready ) {
141
+ if ( ! open ) {
141
142
messages . forEach ( socket . write )
142
143
messages = [ ]
143
- ready = true
144
+ open = true
144
145
}
145
146
146
147
backend . query = queries . shift ( )
148
+ ready = ! backend . query
147
149
}
148
150
149
151
function data ( x ) {
@@ -164,7 +166,7 @@ function Connection(options = {}) {
164
166
function close ( ) {
165
167
error ( errors . connection ( 'CLOSED' , options ) )
166
168
statements = { }
167
- ready = false
169
+ open = ready = false
168
170
}
169
171
170
172
/* c8 ignore next */
You can’t perform that action at this time.
0 commit comments