Skip to content

Commit 9d97dc6

Browse files
committed
do not load inputs/outputs when context is not launched
1 parent ed335be commit 9d97dc6

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

dbos/workflow.go

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,18 @@ type baseWorkflowHandle struct {
9595
}
9696

9797
// GetStatus returns the current status of the workflow from the database
98+
// If the DBOSContext is running in client mode, do not load input and outputs
9899
func (h *baseWorkflowHandle) GetStatus() (WorkflowStatus, error) {
100+
loadInput := false
101+
loadOutput := false
102+
if h.dbosContext.(*dbosContext).launched.Load() {
103+
loadInput = false
104+
loadOutput = false
105+
}
99106
workflowStatuses, err := h.dbosContext.(*dbosContext).systemDB.listWorkflows(h.dbosContext, listWorkflowsDBInput{
100107
workflowIDs: []string{h.workflowID},
101-
loadInput: true,
102-
loadOutput: true,
108+
loadInput: loadInput,
109+
loadOutput: loadOutput,
103110
})
104111
if err != nil {
105112
return WorkflowStatus{}, fmt.Errorf("failed to get workflow status: %w", err)
@@ -1314,10 +1321,16 @@ func GetStepID(ctx DBOSContext) (int, error) {
13141321
}
13151322

13161323
func (c *dbosContext) RetrieveWorkflow(_ DBOSContext, workflowID string) (WorkflowHandle[any], error) {
1324+
loadInput := false
1325+
loadOutput := false
1326+
if c.launched.Load() {
1327+
loadInput = false
1328+
loadOutput = false
1329+
}
13171330
workflowStatus, err := c.systemDB.listWorkflows(c, listWorkflowsDBInput{
13181331
workflowIDs: []string{workflowID},
1319-
loadInput: true,
1320-
loadOutput: true,
1332+
loadInput: loadInput,
1333+
loadOutput: loadOutput,
13211334
})
13221335
if err != nil {
13231336
return nil, fmt.Errorf("failed to retrieve workflow status: %w", err)

0 commit comments

Comments
 (0)