feat: add execution history queries and preserve bounded JSON payloads
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
|
||||
"git.yuntuo.hk/k2safe/orbit/internal/fault"
|
||||
"git.yuntuo.hk/k2safe/orbit/internal/jsonvalue"
|
||||
"git.yuntuo.hk/k2safe/orbit/internal/jsonwire"
|
||||
core "git.yuntuo.hk/k2safe/orbit/model"
|
||||
"git.yuntuo.hk/k2safe/orbit/platform/auth"
|
||||
"git.yuntuo.hk/k2safe/orbit/pulse/worker"
|
||||
@@ -154,7 +155,7 @@ func (h *WorkerHub) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
_ = writeWorkerFrame(ctx, conn, workerFrame{Version: "1", Type: "error", MessageID: requestID, ReplyTo: hello.MessageID, Error: publicWorkerError(err)})
|
||||
return
|
||||
}
|
||||
welcomeRaw, err := json.Marshal(welcome)
|
||||
welcomeRaw, err := jsonwire.Marshal(welcome)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -219,7 +220,7 @@ func (h *WorkerHub) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
raw, err := json.Marshal(frame)
|
||||
raw, err := jsonwire.Marshal(frame)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
@@ -320,7 +321,7 @@ func (h *WorkerHub) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
reply.Type = "error"
|
||||
reply.Error = publicWorkerError(commandErr)
|
||||
} else {
|
||||
reply.Body, commandErr = json.Marshal(body)
|
||||
reply.Body, commandErr = jsonwire.Marshal(body)
|
||||
if commandErr != nil {
|
||||
return
|
||||
}
|
||||
@@ -354,7 +355,7 @@ func (h *WorkerHub) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if assignment == nil {
|
||||
break
|
||||
}
|
||||
raw, err := json.Marshal(assignment)
|
||||
raw, err := jsonwire.Marshal(assignment)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -374,7 +375,7 @@ func publicWorkerError(err error) *fault.Error {
|
||||
return fault.Unavailable
|
||||
}
|
||||
func writeWorkerFrame(ctx context.Context, conn *websocket.Conn, frame workerFrame) error {
|
||||
raw, err := json.Marshal(frame)
|
||||
raw, err := jsonwire.Marshal(frame)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user