Skip to content

Commit 897534b

Browse files
author
“Kevin”
committed
Remove x module reference
1 parent 744f31c commit 897534b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cmd/samples/batch/workflow.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"time"
88

99
"go.uber.org/cadence/workflow"
10-
"go.uber.org/cadence/x"
1110
)
1211

1312
// ApplicationName is the task list for this sample
@@ -36,7 +35,7 @@ func BatchWorkflow(ctx workflow.Context, input BatchWorkflowInput) error {
3635
}
3736

3837
// Execute all activities with controlled concurrency
39-
batch, err := x.NewBatchFuture(ctx, input.Concurrency, factories)
38+
batch, err := workflow.NewBatchFuture(ctx, input.Concurrency, factories)
4039
if err != nil {
4140
return fmt.Errorf("failed to create batch future: %w", err)
4241
}
@@ -51,6 +50,7 @@ func BatchActivity(ctx context.Context, taskID int) error {
5150
// Return error if workflow/activity is cancelled
5251
return fmt.Errorf("batch activity %d failed: %w", taskID, ctx.Err())
5352
case <-time.After(time.Duration(rand.Int63n(100))*time.Millisecond + 900*time.Millisecond):
53+
// Wait for random duration (900-999ms) to simulate work, then return success
5454
return nil
5555
}
5656
}

cmd/samples/batch/workflow_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ func Test_BatchWorkflow(t *testing.T) {
1616
env.RegisterWorkflow(BatchWorkflow)
1717
env.RegisterActivity(BatchActivity)
1818

19-
// Execute workflow with 2 concurrent workers processing 10 tasks
19+
// Execute workflow with 3 concurrent workers processing 10 tasks
2020
env.ExecuteWorkflow(BatchWorkflow, BatchWorkflowInput{
21-
Concurrency: 2,
21+
Concurrency: 3,
2222
TotalSize: 10,
2323
})
2424

0 commit comments

Comments
 (0)