Skip to content

Commit

Permalink
fix: get model issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tikazyq committed Jun 9, 2024
1 parent 54863d2 commit ea01556
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
16 changes: 12 additions & 4 deletions grpc/server/task_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,20 @@ func (svr TaskServer) Fetch(ctx context.Context, request *grpc.Request) (respons

func (svr TaskServer) SendNotification(ctx context.Context, request *grpc.Request) (response *grpc.Response, err error) {
svc := notification.GetService()
var e bson.M
if err := json.Unmarshal(request.Data, &e); err != nil {
var t = new(models.Task)
if err := json.Unmarshal(request.Data, t); err != nil {
return nil, trace.TraceError(err)
}
t, err = svr.modelSvc.GetTaskById(t.Id)
if err != nil {
return nil, trace.TraceError(err)
}
var t models.Task
if err := json.Unmarshal(request.Data, &t); err != nil {
td, err := json.Marshal(t)
if err != nil {
return nil, trace.TraceError(err)
}
var e bson.M
if err := json.Unmarshal(td, &e); err != nil {
return nil, trace.TraceError(err)
}
ts, err := svr.modelSvc.GetTaskStatById(t.Id)
Expand Down
5 changes: 1 addition & 4 deletions task/handler/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ func (r *Runner) Run() (err error) {
// configure logging
r.configureLogging()

// send notification
r.sendNotification()

// start process
if err := r.cmd.Start(); err != nil {
return r.updateTask(constants.TaskStatusError, err)
Expand Down Expand Up @@ -487,7 +484,7 @@ func (r *Runner) updateTask(status string, e error) (err error) {
}

// send notification
r.sendNotification()
go r.sendNotification()

// update stats
go func() {
Expand Down

0 comments on commit ea01556

Please sign in to comment.