grpc-js: Rearrange some function calls to revert event order changes

This commit is contained in:
Michael Lumish 2024-03-05 10:26:39 -08:00
parent 210967ffa3
commit 07ee52acb0
2 changed files with 6 additions and 3 deletions

View File

@ -200,11 +200,11 @@ export class ServerWritableStreamImpl<RequestType, ResponseType>
}
_final(callback: Function): void {
callback(null);
this.call.sendStatus({
...this.pendingStatus,
metadata: this.pendingStatus.metadata ?? this.trailingMetadata,
});
callback(null);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@ -273,11 +273,11 @@ export class ServerDuplexStreamImpl<RequestType, ResponseType>
}
_final(callback: Function): void {
callback(null);
this.call.sendStatus({
...this.pendingStatus,
metadata: this.pendingStatus.metadata ?? this.trailingMetadata,
});
callback(null);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any

View File

@ -842,7 +842,6 @@ export class BaseServerInterceptingCall
if (this.checkCancelled()) {
return;
}
this.notifyOnCancel();
trace(
'Request to method ' +
@ -869,8 +868,11 @@ export class BaseServerInterceptingCall
};
this.stream.sendTrailers(trailersToSend);
this.notifyOnCancel();
});
this.stream.end();
} else {
this.notifyOnCancel();
}
} else {
if (this.callEventTracker && !this.streamEnded) {
@ -886,6 +888,7 @@ export class BaseServerInterceptingCall
...status.metadata?.toHttp2Headers(),
};
this.stream.respond(trailersToSend, { endStream: true });
this.notifyOnCancel();
}
}
startRead(): void {