Skip to content

Commit 8ac1c15

Browse files
authored
Finish redis sub workflows
1 parent e2aea83 commit 8ac1c15

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

backend/redis/instance.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,19 @@ func (rb *redisBackend) CancelWorkflowInstance(ctx context.Context, instance *co
7878
}
7979

8080
type instanceState struct {
81-
InstanceID string `json:"instance_id,omitempty"`
82-
ExecutionID string `json:"execution_id,omitempty"`
83-
State backend.WorkflowState `json:"state,omitempty"`
84-
CreatedAt time.Time `json:"created_at,omitempty"`
85-
CompletedAt *time.Time `json:"completed_at,omitempty"`
81+
Instance *core.WorkflowInstance `json:"instance,omitempty"`
82+
State backend.WorkflowState `json:"state,omitempty"`
83+
CreatedAt time.Time `json:"created_at,omitempty"`
84+
CompletedAt *time.Time `json:"completed_at,omitempty"`
8685
}
8786

8887
func createInstance(ctx context.Context, rdb redis.UniversalClient, instance *core.WorkflowInstance, ignoreDuplicate bool) error {
8988
key := instanceKey(instance.InstanceID)
9089

9190
b, err := json.Marshal(&instanceState{
92-
InstanceID: instance.InstanceID,
93-
ExecutionID: instance.ExecutionID,
94-
State: backend.WorkflowStateActive,
95-
CreatedAt: time.Now(),
91+
Instance: instance,
92+
State: backend.WorkflowStateActive,
93+
CreatedAt: time.Now(),
9694
})
9795
if err != nil {
9896
return errors.Wrap(err, "could not marshal instance state")

backend/redis/workflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (rb *redisBackend) GetWorkflowTask(ctx context.Context) (*task.Workflow, er
7272

7373
return &task.Workflow{
7474
ID: instanceTask.TaskID,
75-
WorkflowInstance: core.NewWorkflowInstance(instanceTask.ID, instanceState.ExecutionID),
75+
WorkflowInstance: instanceState.Instance,
7676
History: historyEvents,
7777
NewEvents: newEvents,
7878
}, nil

0 commit comments

Comments
 (0)