@@ -44,6 +44,8 @@ export class LoadBalancingCall implements Call {
44
44
private writeFilterPending = false ;
45
45
private pendingMessage : { context : MessageContext , message : Buffer } | null = null ;
46
46
private pendingHalfClose = false ;
47
+ private readFilterPending = false ;
48
+ private pendingChildStatus : StatusObject | null = null ;
47
49
private ended = false ;
48
50
private serviceUrl : string ;
49
51
private filterStack : FilterStack ;
@@ -153,14 +155,23 @@ export class LoadBalancingCall implements Call {
153
155
this . listener ! . onReceiveMetadata ( this . filterStack . receiveMetadata ( metadata ) ) ;
154
156
} ,
155
157
onReceiveMessage : message => {
158
+ this . readFilterPending = true ;
156
159
this . filterStack . receiveMessage ( message ) . then ( filteredMesssage => {
160
+ this . readFilterPending = false ;
157
161
this . listener ! . onReceiveMessage ( filteredMesssage ) ;
162
+ if ( this . pendingChildStatus ) {
163
+ this . outputStatus ( this . pendingChildStatus , 'PROCESSED' ) ;
164
+ }
158
165
} , ( status : StatusObject ) => {
159
166
this . cancelWithStatus ( status . code , status . details ) ;
160
167
} ) ;
161
168
} ,
162
169
onReceiveStatus : status => {
163
- this . outputStatus ( status , 'PROCESSED' ) ;
170
+ if ( this . readFilterPending ) {
171
+ this . pendingChildStatus = status ;
172
+ } else {
173
+ this . outputStatus ( status , 'PROCESSED' ) ;
174
+ }
164
175
}
165
176
} ) ;
166
177
} catch ( error ) {
0 commit comments