Skip to content

Instantly share code, notes, and snippets.

@jwulf
Last active February 29, 2020 17:56
Show Gist options
  • Select an option

  • Save jwulf/5c27cbcead60acabb07643296852869f to your computer and use it in GitHub Desktop.

Select an option

Save jwulf/5c27cbcead60acabb07643296852869f to your computer and use it in GitHub Desktop.
private handleGrpcError = (stream: any) => async (err: any) => {
// this.emit('error', err)
this.emit(MiddlewareSignals.Event.Error, err)
// this.logger.error(`GRPC ERROR: ${err.message}`)
this.emit(MiddlewareSignals.Log.Error, `GRPC ERROR: ${err.message}`)
const channelState = await this.watchGrpcChannel()
// this.logger.debug(
// `gRPC Channel state: ${connectivityState[channelState]}`
// )
this.emit(
MiddlewareSignals.Log.Debug,
`gRPC Channel state: ${connectivityState[channelState]}`
)
stream.removeAllListeners()
if (
channelState === GrpcState.READY ||
channelState === GrpcState.IDLE
) {
// this.logger.info('gRPC Channel reconnected')
this.emit(MiddlewareSignals.Log.Info, 'gRPC Channel reconnected')
// this.emit('ready')
this.emit(MiddlewareSignals.Event.Ready)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment