mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: slot hash id must be utf8 in gRPC (#1016)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -537,7 +538,12 @@ func (pr *pureRunner) handleTryCall(tc *runner.TryCall, state *callHandle) error
|
||||
|
||||
state.c = agent_call.(*call)
|
||||
if tc.SlotHashId != "" {
|
||||
state.c.slotHashId = tc.SlotHashId
|
||||
hashId, err := hex.DecodeString(tc.SlotHashId)
|
||||
if err != nil {
|
||||
state.enqueueCallResponse(err)
|
||||
return err
|
||||
}
|
||||
state.c.slotHashId = string(hashId[:])
|
||||
}
|
||||
state.allocatedTime = strfmt.DateTime(time.Now())
|
||||
pr.spawnSubmit(state)
|
||||
|
||||
@@ -2,6 +2,7 @@ package agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
@@ -126,7 +127,7 @@ func (r *gRPCRunner) TryExec(ctx context.Context, call pool.RunnerCall) (bool, e
|
||||
// send explicit NACK
|
||||
err = runnerConnection.Send(&pb.ClientMsg{Body: &pb.ClientMsg_Try{Try: &pb.TryCall{
|
||||
ModelsCallJson: string(modelJSON),
|
||||
SlotHashId: call.SlotHashId(),
|
||||
SlotHashId: hex.EncodeToString([]byte(call.SlotHashId())),
|
||||
}}})
|
||||
if err != nil {
|
||||
logrus.WithError(err).Error("Failed to send message to runner node")
|
||||
|
||||
Reference in New Issue
Block a user