Fix response packages

This commit is contained in:
Александр Федорюк 2022-11-23 12:09:34 +03:00
parent fe0d11add6
commit 6d195ebbc2

View File

@ -75,13 +75,19 @@ func (fDesc *funcDesc) worker() {
if res.err != nil {
if pkg.Metadata.QueueCallback != "" {
pkg.ErrNo = 500
if err != nil {
pkg.Error = err.Error()
} else {
//if err != nil {
pkg.Error = res.err.Error()
/*} else {
pkg.Error = ""
}
}*/
pkg.Metadata.CallResponseID = uuid.NewV4().String()
fDesc.conn.Publish(pkg.Metadata.QueueCallback, []byte(pkg.Error))
buff, err := proto.Marshal(pkg)
if err != nil {
//panic(err)
continue
}
//fDesc.conn.Publish(pkg.Metadata.QueueCallback, []byte(pkg.Error))
fDesc.conn.Publish(pkg.Metadata.QueueCallback, buff)
}
continue
}
@ -105,7 +111,14 @@ func (fDesc *funcDesc) worker() {
//pkg.Error = err.Error()
pkg.Error = "function call timeout"
pkg.Metadata.CallResponseID = uuid.NewV4().String()
fDesc.conn.Publish(pkg.Metadata.QueueCallback, []byte("function call timeout"))
buff, err := proto.Marshal(pkg)
if err != nil {
continue
}
//fDesc.conn.Publish(pkg.Metadata.QueueCallback, []byte("function call timeout"))
if err = fDesc.conn.Publish(pkg.Metadata.QueueCallback, buff); err != nil {
continue
}
}
continue
//}