Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dbos/admin_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (req *listWorkflowsRequest) toListWorkflowsOptions() []ListWorkflowsOption
opts = append(opts, WithOffset(*req.Offset))
}
if req.SortDesc != nil {
opts = append(opts, WithSortDesc(*req.SortDesc))
opts = append(opts, WithSortDesc())
}
if req.WorkflowIDPrefix != nil {
opts = append(opts, WithWorkflowIDPrefix(*req.WorkflowIDPrefix))
Expand Down
5 changes: 2 additions & 3 deletions dbos/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,14 +805,13 @@ func TestListWorkflows(t *testing.T) {

// Test 7: Test sorting order (ascending - default)
ascWorkflows, err := ListWorkflows(clientCtx,
WithWorkflowIDPrefix("test-"),
WithSortDesc(false))
WithWorkflowIDPrefix("test-"))
require.NoError(t, err, "failed to list workflows ascending")

// Test 8: Test sorting order (descending)
descWorkflows, err := ListWorkflows(clientCtx,
WithWorkflowIDPrefix("test-"),
WithSortDesc(true))
WithSortDesc())
require.NoError(t, err, "failed to list workflows descending")

// Verify sorting - workflows should be ordered by creation time
Expand Down
4 changes: 2 additions & 2 deletions dbos/conductor.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ func (c *Conductor) handleListWorkflowsRequest(data []byte, requestID string) er
var opts []ListWorkflowsOption
opts = append(opts, WithLoadInput(req.Body.LoadInput))
opts = append(opts, WithLoadOutput(req.Body.LoadOutput))
opts = append(opts, WithSortDesc(req.Body.SortDesc))
opts = append(opts, WithSortDesc())
if len(req.Body.WorkflowUUIDs) > 0 {
opts = append(opts, WithWorkflowIDs(req.Body.WorkflowUUIDs))
}
Expand Down Expand Up @@ -638,7 +638,7 @@ func (c *Conductor) handleListQueuedWorkflowsRequest(data []byte, requestID stri
var opts []ListWorkflowsOption
opts = append(opts, WithLoadInput(req.Body.LoadInput))
opts = append(opts, WithLoadOutput(false)) // Don't load output for queued workflows
opts = append(opts, WithSortDesc(req.Body.SortDesc))
opts = append(opts, WithSortDesc())
opts = append(opts, WithQueuesOnly()) // Only include workflows that are in queues

// Add status filter for queued workflows
Expand Down
8 changes: 4 additions & 4 deletions dbos/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -1850,10 +1850,10 @@ func WithOffset(offset int) ListWorkflowsOption {
// Example:
//
// workflows, err := dbos.ListWorkflows(ctx,
// dbos.WithSortDesc(true))
func WithSortDesc(sortDesc bool) ListWorkflowsOption {
// dbos.WithSortDesc()
func WithSortDesc() ListWorkflowsOption {
return func(p *ListWorkflowsOptions) {
p.sortDesc = sortDesc
p.sortDesc = true
}
}

Expand Down Expand Up @@ -1970,7 +1970,7 @@ func WithExecutorIDs(executorIDs []string) ListWorkflowsOption {
// dbos.WithUser("john.doe"),
// dbos.WithOffset(50),
// dbos.WithLimit(25),
// dbos.WithSortDesc(true))
// dbos.WithSortDesc()
// if err != nil {
// log.Fatal(err)
// }
Expand Down
6 changes: 3 additions & 3 deletions dbos/workflows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3525,7 +3525,7 @@ func TestGarbageCollect(t *testing.T) {
}

// Get timestamps for testing
workflows, err := ListWorkflows(dbosCtx, WithSortDesc(true))
workflows, err := ListWorkflows(dbosCtx, WithSortDesc())
require.NoError(t, err, "failed to list workflows")
require.Equal(t, numWorkflows, len(workflows))

Expand All @@ -3546,7 +3546,7 @@ func TestGarbageCollect(t *testing.T) {
})
require.NoError(t, err, "failed to garbage collect with threshold 6 and 7th newest timestamp")

workflows, err = ListWorkflows(dbosCtx, WithSortDesc(true))
workflows, err = ListWorkflows(dbosCtx, WithSortDesc())
require.NoError(t, err, "failed to list workflows after first GC")
require.Equal(t, threshold, len(workflows), "expected 6 workflows when threshold has more recent cutoff than timestamp")

Expand All @@ -3562,7 +3562,7 @@ func TestGarbageCollect(t *testing.T) {
})
require.NoError(t, err, "failed to garbage collect with threshold 3 and 2nd newest timestamp")

workflows, err = ListWorkflows(dbosCtx, WithSortDesc(true))
workflows, err = ListWorkflows(dbosCtx, WithSortDesc())
require.NoError(t, err, "failed to list workflows after second GC")
require.Equal(t, 2, len(workflows), "expected 2 workflows after second GC")
require.Equal(t, workflows[0].ID, handles[numWorkflows-1].GetWorkflowID(), "expected newest workflow to remain")
Expand Down
Loading