Skip to content

Commit 4362791

Browse files
committed
test ListQueues + set default statuses when WithQueuesOnly is given
1 parent 22992ab commit 4362791

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dbos/workflow.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,7 @@ func WithQueueName(queueName string) ListWorkflowsOption {
19061906
}
19071907
}
19081908

1909-
// WithQueuesOnly filters to only return workflows that are in a queue (queue_name is not NULL).
1909+
// WithQueuesOnly filters to only return workflows that are in a queue.
19101910
//
19111911
// Example:
19121912
//
@@ -1987,6 +1987,11 @@ func (c *dbosContext) ListWorkflows(_ DBOSContext, opts ...ListWorkflowsOption)
19871987
opt(params)
19881988
}
19891989

1990+
// If we are asked to retrieve only queue workflows with no status, only fetch ENQUEUED and PENDING tasks
1991+
if params.queuesOnly && len(params.status) == 0 {
1992+
params.status = []WorkflowStatusType{WorkflowStatusEnqueued, WorkflowStatusPending}
1993+
}
1994+
19901995
// Convert to system database input structure
19911996
dbInput := listWorkflowsDBInput{
19921997
workflowIDs: params.workflowIDs,

0 commit comments

Comments
 (0)