Commit 4e2bc88d authored by Cloud User's avatar Cloud User

fix async response

parent 027b53f4
......@@ -1274,7 +1274,25 @@ func ApiOrJWT(c *fiber.Ctx) error {
//return c.Send(m)
asyncReq(pbMsg.TaskId)
return c.JSON(pbMsg.TaskId)
res := SyncResponse{
TaskId: pbMsg.TaskId,
}
resAsJson, err := json.Marshal(res)
if err != nil {
newAttributes := append(baseAttributes, slog.String("err", err.Error()))
slog.LogAttrs(c.UserContext(), slog.LevelError, "json.Marshal(res)", newAttributes...)
}
if err := c.Send(resAsJson); err != nil {
newAttributes := append(baseAttributes, slog.String("err", err.Error()))
slog.LogAttrs(c.UserContext(), slog.LevelError, "c.JSON(pbMsg.TaskId);", newAttributes...)
return err
}
return nil
//return c.SendString(pbMsg.TaskId)
......@@ -1283,6 +1301,10 @@ func ApiOrJWT(c *fiber.Ctx) error {
}
}
type SyncResponse struct {
TaskId string `json:"task_id"`
}
func isBase64(s []byte) bool {
_, err := base64.StdEncoding.DecodeString(string(s))
return err == nil
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment