mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: lb-agent & runner gRPC updates (#1005)
Breaking changes: *) Removed unused ACK/NACK definitions *) Extended Finished messages with error code/str
This commit is contained in:
@@ -199,19 +199,19 @@ func (ch *callHandle) enqueueMsgStrict(msg *runner.RunnerMsg) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func convertError(err error) string {
|
||||
code := models.GetAPIErrorCode(err)
|
||||
return fmt.Sprintf("%d:%s", code, err.Error())
|
||||
}
|
||||
|
||||
// enqueueCallResponse enqueues a Submit() response to the LB
|
||||
// and initiates a graceful shutdown of the session.
|
||||
func (ch *callHandle) enqueueCallResponse(err error) {
|
||||
var details string
|
||||
var errCode int
|
||||
var errStr string
|
||||
|
||||
if err != nil {
|
||||
details = convertError(err)
|
||||
} else if ch.c != nil {
|
||||
errCode = models.GetAPIErrorCode(err)
|
||||
errStr = err.Error()
|
||||
}
|
||||
|
||||
if ch.c != nil {
|
||||
details = ch.c.Model().ID
|
||||
}
|
||||
|
||||
@@ -219,18 +219,20 @@ func (ch *callHandle) enqueueCallResponse(err error) {
|
||||
|
||||
errTmp := ch.enqueueMsgStrict(&runner.RunnerMsg{
|
||||
Body: &runner.RunnerMsg_Finished{Finished: &runner.CallFinished{
|
||||
Success: err == nil,
|
||||
Details: details,
|
||||
Success: err == nil,
|
||||
Details: details,
|
||||
ErrorCode: int32(errCode),
|
||||
ErrorStr: errStr,
|
||||
}}})
|
||||
|
||||
if errTmp != nil {
|
||||
logrus.WithError(errTmp).Infof("enqueueCallResponse Send Error details=%v", details)
|
||||
logrus.WithError(errTmp).Infof("enqueueCallResponse Send Error details=%v err=%v:%v", details, errCode, errStr)
|
||||
return
|
||||
}
|
||||
|
||||
errTmp = ch.finalize()
|
||||
if errTmp != nil {
|
||||
logrus.WithError(errTmp).Infof("enqueueCallResponse Finalize Error details=%v", details)
|
||||
logrus.WithError(errTmp).Infof("enqueueCallResponse Finalize Error details=%v err=%v:%v", details, errCode, errStr)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user