From cda5c69f4ff5d589b87a1ca1a873dd66527996b3 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 17 Aug 2023 16:16:27 +0800 Subject: [PATCH] fix --- server/websocket/internal/logic/rendernotifylogic.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/websocket/internal/logic/rendernotifylogic.go b/server/websocket/internal/logic/rendernotifylogic.go index c05db381..afa76e64 100644 --- a/server/websocket/internal/logic/rendernotifylogic.go +++ b/server/websocket/internal/logic/rendernotifylogic.go @@ -40,14 +40,16 @@ func NewRenderNotifyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Rend // } func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *auth.UserInfo) (resp *basic.Response) { - logx.Info("收到渲染回调数据:", *req) if req.TaskId == "" { + logx.Error("渲染回调参数错误:invalid param task_id") return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid param task_id") } if req.Image == "" { + logx.Error("渲染回调参数错误:invalid param image") return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid param image") } if req.UserId == 0 && req.GuestId == 0 { + logx.Error("渲染回调参数错误:invalid user_id or guest_id") return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid user_id or guest_id") } // 上传文件 @@ -68,7 +70,7 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a FileByte: nil, }) if err != nil { - logx.Error(err) + logx.Error("渲染回调上传文件失败:", err) return resp.SetStatusWithMessage(basic.CodeFileUploadErr, "failed to upload render resource image") } //遍历websocket链接把数据传进去 @@ -76,6 +78,7 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a //断言连接 ws, ok := value.(wsConnectItem) if !ok { + logx.Error("渲染回调断言websocket连接失败") return true } //关闭标识 @@ -102,10 +105,10 @@ func (l *RenderNotifyLogic) RenderNotify(req *types.RenderNotifyReq, userinfo *a case ws.renderProperty.renderImageTaskCtlChan <- deleteTask: //删除对应的需要渲染的图片map //发送数据到out chan ws.sendToOutChan(b) + return true case <-time.After(time.Second * 3): //超时丢弃 return true } - return true }) logx.Info("渲染回调成功######################") return resp.SetStatusWithMessage(basic.CodeOK, "success")