diff --git a/services/tasks/scheduler/publisher.go b/services/tasks/scheduler/publisher.go index 27ae10134..c4973c994 100644 --- a/services/tasks/scheduler/publisher.go +++ b/services/tasks/scheduler/publisher.go @@ -35,7 +35,7 @@ func (s *TaskScheduler) runPublisher(ctx context.Context) error { params, err := JSONBToMap(run.Params) if err != nil { result := pgtype.JSONB{} - _ = result.Set([]byte("")) + _ = result.Set([]byte("{}")) _ = s.db.UpdateTaskRun(run.ID, models.TaskRunStatusFailed, result, "failed to get params") s.logger.Error("failed to get params", zap.Error(err), zap.Uint("runId", run.ID)) return err @@ -55,7 +55,7 @@ func (s *TaskScheduler) runPublisher(ctx context.Context) error { reqJson, err := json.Marshal(req) if err != nil { result := pgtype.JSONB{} - _ = result.Set([]byte("")) + _ = result.Set([]byte("{}")) _ = s.db.UpdateTaskRun(run.ID, models.TaskRunStatusFailed, result, "failed to marshal run") s.logger.Error("failed to marshal Task Run", zap.Error(err), zap.Uint("runId", run.ID)) return err @@ -73,21 +73,21 @@ func (s *TaskScheduler) runPublisher(ctx context.Context) error { _, err = s.jq.Produce(ctx, s.NatsConfig.Topic, reqJson, fmt.Sprintf("run-%d", run.ID)) if err != nil { result := pgtype.JSONB{} - _ = result.Set([]byte("")) + _ = result.Set([]byte("{}")) _ = s.db.UpdateTaskRun(run.ID, models.TaskRunStatusFailed, result, err.Error()) s.logger.Error("failed to send run", zap.Error(err), zap.Uint("runId", run.ID)) continue } } else { result := pgtype.JSONB{} - _ = result.Set([]byte("")) + _ = result.Set([]byte("{}")) _ = s.db.UpdateTaskRun(run.ID, models.TaskRunStatusFailed, result, err.Error()) s.logger.Error("failed to send run", zap.Error(err), zap.Uint("runId", run.ID), zap.String("error message", err.Error())) continue } } else { result := pgtype.JSONB{} - _ = result.Set([]byte("")) + _ = result.Set([]byte("{}")) _ = s.db.UpdateTaskRun(run.ID, models.TaskRunStatusQueued, result, "") } }