Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: strip task payload for saving issue response size at main page (#5572)

Danny Xu4cb4b4ce9691
diff --git a/backend/legacyapi/task.go b/backend/legacyapi/task.go
index 309222c1da..f1b8f493fc 100644
--- a/backend/legacyapi/task.go
+++ b/backend/legacyapi/task.go
@@ -323,6 +323,9 @@ type TaskFind struct {
Payload string
NoBlockingStage bool
NonRollbackTask bool
+
+ // Strip the task payload statement.
+ StripPayload bool
}
func (find *TaskFind) String() string {
diff --git a/backend/store/issue.go b/backend/store/issue.go
index e47dedd650..83d8f6414a 100644
--- a/backend/store/issue.go
+++ b/backend/store/issue.go
@@ -449,7 +449,8 @@ func (s *Store) composePipeline(ctx context.Context, pipeline *PipelineMessage)
}
func (s *Store) composeSimplePipeline(ctx context.Context, pipeline *PipelineMessage) (*api.Pipeline, error) {
- tasks, err := s.ListTasks(ctx, &api.TaskFind{PipelineID: &pipeline.ID})
+ // Strip the task payload statement to reduce the response size.
+ tasks, err := s.ListTasks(ctx, &api.TaskFind{PipelineID: &pipeline.ID, StripPayload: true})
if err != nil {
return nil, errors.Wrapf(err, "failed to find tasks for pipeline %d", pipeline.ID)
}
@@ -547,6 +548,8 @@ type FindIssueMessage struct {
SinceID *int
// If specified, then it will only fetch "Limit" most recently updated issues
Limit *int
+
+ Stripped bool
}
// GetIssueV2 gets issue by issue UID.
diff --git a/backend/store/task.go b/backend/store/task.go
index e28a114260..f4ba080a91 100644
--- a/backend/store/task.go
+++ b/backend/store/task.go
@@ -349,6 +349,11 @@ func (s *Store) ListTasks(ctx context.Context, find *api.TaskFind) ([]*TaskMessa
where = append(where, "(NOT (task.type='bb.task.database.data.update' AND task.payload->>'rollbackFromTaskId' IS NOT NULL))")
}
+ payloadField := "task.payload"
+ if find.StripPayload {
+ payloadField = "''"
+ }
+
tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})
if err != nil {
return nil, err
@@ -369,14 +374,14 @@ func (s *Store) ListTasks(ctx context.Context, find *api.TaskFind) ([]*TaskMessa
task.name,
task.status,
task.type,
- task.payload,
+ %s,
task.earliest_allowed_ts,
ARRAY_AGG (task_dag.from_task_id) blocked_by
FROM task
LEFT JOIN task_dag ON task.id = task_dag.to_task_id
WHERE %s
GROUP BY task.id
- ORDER BY task.id ASC`, strings.Join(where, " AND ")),
+ ORDER BY task.id ASC`, payloadField, strings.Join(where, " AND ")),
args...,
)
if err != nil {