Skip to content

Commit b2e8114

Browse files
authored
Store instance in activity queue
1 parent 4685396 commit b2e8114

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

backend/redis/activity.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func (rb *redisBackend) GetActivityTask(ctx context.Context) (*task.Activity, er
1919
}
2020

2121
return &task.Activity{
22-
WorkflowInstance: core.NewWorkflowInstance(activityTask.Data.InstanceID, activityTask.Data.ExecutionID),
22+
WorkflowInstance: activityTask.Data.Instance,
2323
ID: activityTask.TaskID, // Use the queue generated ID here
2424
Event: activityTask.Data.Event,
2525
}, nil

backend/redis/redis.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55

66
"github.com/cschleiden/go-workflows/backend"
77
"github.com/cschleiden/go-workflows/backend/redis/taskqueue"
8+
"github.com/cschleiden/go-workflows/internal/core"
89
"github.com/cschleiden/go-workflows/internal/history"
910
"github.com/cschleiden/go-workflows/log"
1011
"github.com/go-redis/redis/v8"
@@ -86,10 +87,9 @@ type redisBackend struct {
8687
}
8788

8889
type activityData struct {
89-
InstanceID string `json:"instance_id,omitempty"`
90-
ExecutionID string `json:"execution_id,omitempty"`
91-
ID string `json:"id,omitempty"`
92-
Event history.Event `json:"event,omitempty"`
90+
Instance *core.WorkflowInstance `json:"instance,omitempty"`
91+
ID string `json:"id,omitempty"`
92+
Event history.Event `json:"event,omitempty"`
9393
}
9494

9595
type workflowTaskData struct {

backend/redis/workflow.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ func (rb *redisBackend) CompleteWorkflowTask(ctx context.Context, taskID string,
215215
// Store activity data
216216
for _, activityEvent := range activityEvents {
217217
if _, err := rb.activityQueue.Enqueue(ctx, activityEvent.ID, &activityData{
218-
InstanceID: instance.InstanceID,
219-
ID: activityEvent.ID,
220-
Event: activityEvent,
218+
Instance: instance,
219+
ID: activityEvent.ID,
220+
Event: activityEvent,
221221
}); err != nil {
222222
return errors.Wrap(err, "could not queue activity task")
223223
}

0 commit comments

Comments
 (0)